Put data from job on job page

The main change is showing the finished time if the job is finished, rather
than the start time.
This commit is contained in:
Chris Hill-Scott
2016-03-02 16:15:15 +00:00
parent 3a3e4258ef
commit d9073862fa
6 changed files with 77 additions and 31 deletions

View File

@@ -42,23 +42,26 @@ def view_job(service_id, job_id):
try:
job = job_api_client.get_job(service_id, job_id)['data']
notifications = notification_api_client.get_notifications_for_service(service_id, job_id)
finished = job['status'] == 'finished'
return render_template(
'views/job.html',
notifications=notifications['notifications'],
counts={
'total': len(notifications),
'delivered': len(notifications),
'queued': 0 if finished else job['notification_count'],
'sent': job['notification_count'] if finished else 0,
'failed': 0
},
uploaded_at=job['created_at'],
finished_at=job['updated_at'] if finished else None,
cost=u'£0.00',
uploaded_file_name=job['original_file_name'],
uploaded_file_time=job['created_at'],
template=Template(
templates_dao.get_service_template_or_404(service_id, job['template'])['data'],
prefix=service['name']
),
service_id=service_id,
service=service
from_name=service['name'],
job_id=job_id
)
except HTTPError as e:
if e.status_code == 404: