This is an automated email from the ASF dual-hosted git repository.
lahirujayathilake pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/airavata-django-portal.git
The following commit(s) were added to refs/heads/master by this push:
new 06c31352 bug fix - handle workspace preference when there are no
recent projects
06c31352 is described below
commit 06c31352b89eae75bd3c244c5c6f876508a988a7
Author: lahiruj <[email protected]>
AuthorDate: Mon Aug 18 12:55:42 2025 -0400
bug fix - handle workspace preference when there are no recent projects
---
django_airavata/apps/api/helpers.py | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/django_airavata/apps/api/helpers.py
b/django_airavata/apps/api/helpers.py
index 1d4a685c..bf5aca74 100644
--- a/django_airavata/apps/api/helpers.py
+++ b/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))