Skip to content

Commit

Permalink
fix display of user_sync_dt
Browse files Browse the repository at this point in the history
  • Loading branch information
claire-peters committed Dec 20, 2023
1 parent e5dc8c4 commit a7ca488
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -421,7 +421,9 @@ <h3 class="d-inline">
<h3 class="d-inline"><i class="fas fa-users" aria-hidden="true"></i> Users in Allocation</h3>
<span class="badge badge-secondary">{{allocation_users.count}}</span>
<!--show user_sync_dt on the right side of the div header-->
{% if user_sync_dt %}
<span class="float-right">Last Sync: {{user_sync_dt}}</span>
{% endif %}
<div class="float-right">

{% comment %}
Expand Down
11 changes: 7 additions & 4 deletions coldfront/core/allocation/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,14 @@ def get_context_data(self, **kwargs):
# get last successful runs of djangoq task responsible for allocationuser data pull
if allocation_obj.get_parent_resource.resource_type.name == "Storage":
sync_task_name = "pullsf_pushcf_redash"
user_sync_task = Task.objects.filter(
func__contains=sync_task_name, success=True
).order_by('started').last()
elif allocation_obj.get_parent_resource.resource_type.name == "Cluster":
sync_task_name = "xdmod_usage"
user_sync_task = Task.objects.filter(
func__contains=sync_task_name, success=True
).order_by('started').last()
user_sync_task = Task.objects.filter(
func__contains=sync_task_name, success=True
).order_by('started').last()

user_sync_dt = None if not user_sync_task else user_sync_task.started
else:
Expand Down Expand Up @@ -388,7 +391,7 @@ def get_queryset(self):
allocation_search_form = AllocationSearchForm(self.request.GET)

allocations = Allocation.objects.prefetch_related(
'project', 'project__pi', 'status'
'project', 'project__pi', 'status', 'resources'
)
if allocation_search_form.is_valid():
data = allocation_search_form.cleaned_data
Expand Down

0 comments on commit a7ca488

Please sign in to comment.