From d69b7f6f8eec3996afd9c1296aaaa47ce8790b03 Mon Sep 17 00:00:00 2001 From: Asim Regmi Date: Fri, 8 Dec 2023 09:22:13 -0600 Subject: [PATCH] applying sort to categoryResult --- server/portal/apps/workspace/api/views.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/server/portal/apps/workspace/api/views.py b/server/portal/apps/workspace/api/views.py index e0ab3e85f..6cb7c8aff 100644 --- a/server/portal/apps/workspace/api/views.py +++ b/server/portal/apps/workspace/api/views.py @@ -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')) @@ -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