Don’t show cancelled jobs anywhere

The information about a job doesn’t make sense if a job is cancelled.

We could change the information to reflect that the job won’t be sent/
wasn’t sent/was cancelled, but there’s nothing you can really do with
this info.

So instead let’s:
- hide cancelled jobs from the dashboard
- hide cancelled jobs from the jobs page
- 404 the page if the user tries to click back enough times to hit the
  job page
This commit is contained in:
Chris Hill-Scott
2016-09-01 15:46:16 +01:00
parent fb2db09184
commit c94675f457
4 changed files with 41 additions and 3 deletions

View File

@@ -120,7 +120,7 @@ def get_dashboard_partials(service_id):
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'
job for job in jobs if job['job_status'] not in ['scheduled', 'cancelled']
]
service = service_api_client.get_detailed_service(service_id)

View File

@@ -67,7 +67,7 @@ def view_jobs(service_id):
'views/jobs/jobs.html',
jobs=add_rate_to_jobs([
job for job in job_api_client.get_job(service_id)['data']
if job['job_status'] != 'scheduled'
if job['job_status'] not in ['scheduled', 'cancelled']
])
)
@@ -78,6 +78,10 @@ def view_jobs(service_id):
def view_job(service_id, job_id):
job = job_api_client.get_job(service_id, job_id)['data']
if job['job_status'] == 'cancelled':
abort(404)
filter_args = _parse_filter_args(request.args)
filter_args['status'] = _set_status_filters(filter_args)