Skip to content

Commit

Permalink
applying sort to categoryResult
Browse files Browse the repository at this point in the history
  • Loading branch information
asimregmi committed Dec 8, 2023
1 parent ecbe0f9 commit d69b7f6
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion server/portal/apps/workspace/api/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -444,7 +444,7 @@ def getPublicApps(self, user):
matching_app = next((x for x in sorted(apps_listing, key=lambda y: y.version) if portal_app_id in [x.id, f'{x.id}-{x.version}']), None)
if matching_app:
tapis_apps.append({**portal_app, 'label': portal_app['label'] or matching_app.notes.label})
tapis_apps = sorted(tapis_apps, key=lambda app: app['label'] or app['appId'])

html_apps = list(AppTrayEntry.objects.all().filter(available=True, category=category, appType='html')
.order_by(Coalesce('label', 'appId')).values('appId', 'appType', 'html', 'icon', 'label', 'version'))

Expand All @@ -459,6 +459,7 @@ def getPublicApps(self, user):

categoryResult["apps"].append(app)

categoryResult["apps"] = sorted(categoryResult["apps"], key=lambda app: app['label'] or app['appId'])
categories.append(categoryResult)

return categories, html_definitions
Expand Down

0 comments on commit d69b7f6

Please sign in to comment.