mirror of
https://github.com/GSA/notifications-api.git
synced 2026-01-30 14:31:57 -05:00
Sort jobs by processed time first
Say you have a dashboard with some jobs you sent. Normally looks like: job | sent --- | --- file.csv | **5pm** file.csv | 3pm file.csv | 1pm file.csv | 11am However if your 5pm job was scheduled at lunchtime, then it will look like this: job | sent --- | --- file.csv | 3pm file.csv | 1pm file.csv | **5pm** file.csv | 11am This is because the jobs are sorted by when they were created, not when they were sent. It looks wrong. **For jobs that have already been sent** This commit changes the sort order to be based on `processed_at` instead. **For upcoming jobs** If a job doesn’t have a `processed_at` time then it’s scheduled, but hasn’t started yet. Only in this case should we still be sorting by `created_at`.
This commit is contained in:
@@ -264,7 +264,8 @@ def sample_job(notify_db,
|
||||
notification_count=1,
|
||||
created_at=None,
|
||||
job_status='pending',
|
||||
scheduled_for=None):
|
||||
scheduled_for=None,
|
||||
processing_started=None):
|
||||
if service is None:
|
||||
service = sample_service(notify_db, notify_db_session)
|
||||
if template is None:
|
||||
@@ -281,7 +282,8 @@ def sample_job(notify_db,
|
||||
'created_at': created_at or datetime.utcnow(),
|
||||
'created_by': service.created_by,
|
||||
'job_status': job_status,
|
||||
'scheduled_for': scheduled_for
|
||||
'scheduled_for': scheduled_for,
|
||||
'processing_started': processing_started
|
||||
}
|
||||
job = Job(**data)
|
||||
dao_create_job(job)
|
||||
|
||||
Reference in New Issue
Block a user