From bf872ab3421b668aedcc1780d4305dbd86ef7055 Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Tue, 30 Aug 2016 15:13:37 +0100 Subject: [PATCH] =?UTF-8?q?Base=20=E2=80=98%=20complete=E2=80=99=20on=20no?= =?UTF-8?q?tifications=20requested?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit The job is complete when all notifications are delivered or failed. The report is complete once we have all notifications are in the database. This commit changes the meaning of the percentage from the former to the latter. This is how it was before we removed the aggregate stats for jobs. --- app/main/views/jobs.py | 2 +- tests/__init__.py | 2 ++ tests/conftest.py | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/main/views/jobs.py b/app/main/views/jobs.py index 90e0c0429..1b9c5cc8a 100644 --- a/app/main/views/jobs.py +++ b/app/main/views/jobs.py @@ -326,7 +326,7 @@ def get_job_partials(job): 'partials/jobs/notifications.html', notifications=notifications['notifications'], more_than_one_page=bool(notifications.get('links', {}).get('next')), - percentage_complete=(job['notifications_sent'] / job['notification_count'] * 100), + percentage_complete=(job['notifications_requested'] / job['notification_count'] * 100), download_link=url_for( '.view_job_csv', service_id=current_service['id'], diff --git a/tests/__init__.py b/tests/__init__.py index bfd085d3d..cc7540638 100644 --- a/tests/__init__.py +++ b/tests/__init__.py @@ -156,6 +156,7 @@ def job_json(service_id, original_file_name="thisisatest.csv", notification_count=1, notifications_sent=1, + notifications_requested=1, status=None): if job_id is None: job_id = str(generate_uuid()) @@ -174,6 +175,7 @@ def job_json(service_id, 'created_at': created_at, 'notification_count': notification_count, 'notifications_sent': notifications_sent, + 'notifications_requested': notifications_requested, 'status': status, 'created_by': created_by_json( created_by.id, diff --git a/tests/conftest.py b/tests/conftest.py index b86f829c0..854b44baf 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -864,7 +864,7 @@ def mock_get_job_in_progress(mocker, api_user_active): return {"data": job_json( service_id, api_user_active, job_id=job_id, notification_count=10, - notifications_sent=5 + notifications_requested=5 )} return mocker.patch('app.job_api_client.get_job', side_effect=_get_job)