mirror of
https://github.com/YunoHost/moulinette.git
synced 2024-09-03 20:06:31 +02:00
correction for the limit option
This commit is contained in:
parent
80a3c07b68
commit
cf6173b5e2
1 changed files with 15 additions and 12 deletions
|
@ -131,21 +131,21 @@ def app_list(offset=None, limit=None, filter=None, raw=False):
|
||||||
app_dict.update(json.loads(str(json_list.read())))
|
app_dict.update(json.loads(str(json_list.read())))
|
||||||
|
|
||||||
if len(app_dict) > (0 + offset) and limit > 0:
|
if len(app_dict) > (0 + offset) and limit > 0:
|
||||||
i = 0 + offset
|
|
||||||
sorted_app_dict = {}
|
sorted_app_dict = {}
|
||||||
for sorted_keys in sorted(app_dict.keys())[i:]:
|
for sorted_keys in sorted(app_dict.keys())[i:]:
|
||||||
if i <= limit:
|
sorted_app_dict[sorted_keys] = app_dict[sorted_keys]
|
||||||
sorted_app_dict[sorted_keys] = app_dict[sorted_keys]
|
|
||||||
i += 1
|
i = 0
|
||||||
for app_id, app_info in sorted_app_dict.items():
|
for app_id, app_info in sorted_app_dict.items():
|
||||||
if (filter and ((filter in app_id) or (filter in app_info['manifest']['name']))) or not filter:
|
if i < limit:
|
||||||
instance_number = len(_installed_instance_number(app_id))
|
if (filter and ((filter in app_id) or (filter in app_info['manifest']['name']))) or not filter:
|
||||||
if instance_number > 1:
|
instance_number = len(_installed_instance_number(app_id))
|
||||||
installed_txt = 'Yes ('+ str(instance_number) +' times)'
|
if instance_number > 1:
|
||||||
elif instance_number == 1:
|
installed_txt = 'Yes ('+ str(instance_number) +' times)'
|
||||||
installed_txt = 'Yes'
|
elif instance_number == 1:
|
||||||
else:
|
installed_txt = 'Yes'
|
||||||
installed_txt = 'No'
|
else:
|
||||||
|
installed_txt = 'No'
|
||||||
|
|
||||||
if raw:
|
if raw:
|
||||||
list_dict[app_id] = app_info
|
list_dict[app_id] = app_info
|
||||||
|
@ -156,6 +156,9 @@ def app_list(offset=None, limit=None, filter=None, raw=False):
|
||||||
('Description', app_info['manifest']['description']),
|
('Description', app_info['manifest']['description']),
|
||||||
('Installed', installed_txt)
|
('Installed', installed_txt)
|
||||||
]
|
]
|
||||||
|
i += 1
|
||||||
|
else:
|
||||||
|
break
|
||||||
|
|
||||||
return list_dict
|
return list_dict
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue