Put real notifications on job page

This commit is contained in:
Chris Hill-Scott
2016-03-02 15:37:35 +00:00
parent 2f76ef27ce
commit a4a93116be
4 changed files with 12 additions and 18 deletions

View File

@@ -10,7 +10,7 @@ from flask_login import login_required
from notifications_python_client.errors import HTTPError
from utils.template import Template
from app import job_api_client
from app import job_api_client, notification_api_client
from app.main import main
from app.main.dao import templates_dao
from app.main.dao import services_dao
@@ -41,18 +41,14 @@ def view_job(service_id, job_id):
service = services_dao.get_service_by_id_or_404(service_id)
try:
job = job_api_client.get_job(service_id, job_id)['data']
messages = []
notifications = notification_api_client.get_notifications_for_service(service_id, job_id)
return render_template(
'views/job.html',
messages=messages,
notifications=notifications['notifications'],
counts={
'total': len(messages),
'delivered': len([
message for message in messages if message['status'] == 'Delivered'
]),
'failed': len([
message for message in messages if message['status'] == 'Failed'
])
'total': len(notifications),
'delivered': len(notifications),
'failed': 0
},
cost=u'£0.00',
uploaded_file_name=job['original_file_name'],