From a0e3a648f37285a4a6660aab7ebb66c2e2a3174c Mon Sep 17 00:00:00 2001 From: Chris Hill-Scott Date: Mon, 18 Apr 2016 11:27:23 +0100 Subject: [PATCH] Fix innacurate error message on CSV check We only know if a row contains missing cell(s), not how many cells are missing data. This commit changes the error message to be more accurate. --- app/utils.py | 4 ++-- tests/app/main/test_errors_for_csv.py | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/app/utils.py b/app/utils.py index fbefa6aed..eeba867dc 100644 --- a/app/utils.py +++ b/app/utils.py @@ -79,9 +79,9 @@ def get_errors_for_csv(recipients, template_type): if recipients.rows_with_missing_data: number_of_rows_with_missing_data = len(list(recipients.rows_with_missing_data)) if 1 == number_of_rows_with_missing_data: - errors.append("fill in 1 empty cell") + errors.append("enter missing data in 1 row") else: - errors.append("fill in {} empty cells".format(number_of_rows_with_missing_data)) + errors.append("enter missing data in {} rows".format(number_of_rows_with_missing_data)) return errors diff --git a/tests/app/main/test_errors_for_csv.py b/tests/app/main/test_errors_for_csv.py index 471c9fed2..3ea2cf6f4 100644 --- a/tests/app/main/test_errors_for_csv.py +++ b/tests/app/main/test_errors_for_csv.py @@ -49,7 +49,7 @@ MockRecipients = namedtuple( [ 'add a column called ‘name’', 'fix 1 phone number', - 'fill in 1 empty cell' + 'enter missing data in 1 row' ] ), ( @@ -63,7 +63,7 @@ MockRecipients = namedtuple( [ 'add columns called ‘name’, ‘date’, and ‘time’', 'fix 4 phone numbers', - 'fill in 4 empty cells' + 'enter missing data in 4 rows' ] ) ]