This is an automated email from the ASF dual-hosted git repository.
lahirujayathilake pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/airavata-portals.git
The following commit(s) were added to refs/heads/main by this push:
new eece45aab bug fix - handle workspace preference when there are no
recent projects
eece45aab is described below
commit eece45aab5989be2eb84d3158f27c996ccfbbaa7
Author: lahiruj <[email protected]>
AuthorDate: Wed Jul 30 10:35:34 2025 -0400
bug fix - handle workspace preference when there are no recent projects
---
airavata-django-portal/django_airavata/apps/api/helpers.py | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/airavata-django-portal/django_airavata/apps/api/helpers.py
b/airavata-django-portal/django_airavata/apps/api/helpers.py
index 1d4a685cd..bf5aca74d 100644
--- a/airavata-django-portal/django_airavata/apps/api/helpers.py
+++ b/airavata-django-portal/django_airavata/apps/api/helpers.py
@@ -58,11 +58,14 @@ class WorkspacePreferencesHelper:
if (not prefs.most_recent_project_id or
not self._can_write(request, prefs.most_recent_project_id)):
most_recent_project = self._get_most_recent_project(request)
- logger.warn(
- "_check: updating most_recent_project_id to {}".format(
- most_recent_project.projectID))
- prefs.most_recent_project_id = most_recent_project.projectID
- prefs.save()
+ if most_recent_project is not None:
+ logger.info("_check: updating most_recent_project_id to
{}".format(most_recent_project.projectID))
+ prefs.most_recent_project_id = most_recent_project.projectID
+ prefs.save()
+ else:
+ logger.warning("_check: no writeable projects found, unsetting
most_recent_project_id")
+ prefs.most_recent_project_id = None
+ prefs.save()
group_resource_profiles = request.airavata_client.getGroupResourceList(
request.authz_token, settings.GATEWAY_ID)
group_resource_profile_ids = list(map(lambda g:
g.groupResourceProfileId, group_resource_profiles))