Sort scheduled jobs so soonest is first

The scheduled job you probably care about the most is the soonest –
irrespective of when you scheduled it.
This commit is contained in:
Chris Hill-Scott
2016-08-31 16:50:45 +01:00
parent 72f92b5249
commit 6921d8b59e
3 changed files with 8 additions and 4 deletions

View File

@@ -116,9 +116,9 @@ def get_dashboard_partials(service_id):
job for job in job_api_client.get_job(service_id, limit_days=7)['data']
if job['original_file_name'] != current_app.config['TEST_MESSAGE_FILENAME']
])
scheduled_jobs = [
scheduled_jobs = sorted([
job for job in jobs if job['job_status'] == 'scheduled'
]
], key=lambda job: job['scheduled_for'])
immediate_jobs = [
job for job in jobs if job['job_status'] != 'scheduled'
]