Don’t show the download until the job is complete

The CSV report isn’t very useful until it has all the rows from your
original file. So we shouldn’t show you the link until all notifications
have been created.

Until this point, it’s useful to know how much longer you need to wait,
so this commit adds a percentage count of how much of the file has been
processed.
This commit is contained in:
Chris Hill-Scott
2016-08-02 21:27:23 +01:00
parent 45ae43d987
commit e621dddd6d
4 changed files with 53 additions and 9 deletions

View File

@@ -312,6 +312,9 @@ def _get_job_counts(job, help_argument):
def get_job_partials(job):
filter_args = _parse_filter_args(request.args)
_set_status_filters(filter_args)
notifications = notification_api_client.get_notifications_for_service(
job['service'], job['id'], status=filter_args.get('status')
)
return {
'counts': render_template(
'partials/jobs/count.html',
@@ -321,9 +324,9 @@ def get_job_partials(job):
),
'notifications': render_template(
'partials/jobs/notifications.html',
notifications=notification_api_client.get_notifications_for_service(
job['service'], job['id'], status=filter_args.get('status')
)['notifications'],
notifications=notifications['notifications'],
more_than_one_page=bool(notifications.get('links', {}).get('next')),
percentage_complete=(job['notifications_sent'] / job['notification_count'] * 100),
download_link=url_for(
'.view_job_csv',
service_id=current_service['id'],