Merge pull request #1797 from GSA/2709-bug-sorting-error-on-activity-page

Updated the job listing query to sort by the most recent activity
This commit is contained in:
ccostino
2025-06-27 09:52:38 -04:00
committed by GitHub
3 changed files with 52 additions and 14 deletions

View File

@@ -75,7 +75,9 @@ def dao_get_jobs_by_service_id(
stmt = (
select(Job)
.where(*query_filter)
.order_by(Job.processing_started.desc(), Job.created_at.desc())
.order_by(
func.coalesce(Job.processing_started, Job.created_at).desc(), Job.id.desc()
)
.limit(page_size)
.offset(offset)
)