mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-05-02 07:00:51 -04:00
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:
@@ -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'
|
||||
]
|
||||
|
||||
@@ -184,11 +184,14 @@ def test_should_show_upcoming_jobs_on_dashboard(
|
||||
page = BeautifulSoup(response.data.decode('utf-8'), 'html.parser')
|
||||
|
||||
table_rows = page.find_all('tbody')[0].find_all('tr')
|
||||
assert len(table_rows) == 1
|
||||
assert len(table_rows) == 2
|
||||
|
||||
assert 'send_me_later.csv' in table_rows[0].find_all('th')[0].text
|
||||
assert 'Sending at 11:09am' in table_rows[0].find_all('th')[0].text
|
||||
assert table_rows[0].find_all('td')[0].text.strip() == '1'
|
||||
assert 'even_later.csv' in table_rows[1].find_all('th')[0].text
|
||||
assert 'Sending at 11:09pm' in table_rows[1].find_all('th')[0].text
|
||||
assert table_rows[1].find_all('td')[0].text.strip() == '1'
|
||||
|
||||
|
||||
@freeze_time("2016-01-01 11:09:00.061258")
|
||||
|
||||
@@ -902,7 +902,8 @@ def mock_get_jobs(mocker, api_user_active):
|
||||
("all email addresses.xlsx", '', 'pending'),
|
||||
("applicants.ods", '', ''),
|
||||
("thisisatest.csv", '', ''),
|
||||
("send_me_later.csv", '2016-01-01 11:09:00.061258', 'scheduled')
|
||||
("send_me_later.csv", '2016-01-01 11:09:00.061258', 'scheduled'),
|
||||
("even_later.csv", '2016-01-01 23:09:00.061258', 'scheduled')
|
||||
)
|
||||
]}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user