Validate CSVs against rows with empty messages

This commit is contained in:
Pea Tyczynska
2019-11-21 12:12:04 +00:00
parent 512094c52c
commit f265dde8ab
6 changed files with 205 additions and 12 deletions

View File

@@ -131,6 +131,20 @@ def get_errors_for_csv(recipients, template_type):
else:
errors.append("enter missing data in {} rows".format(number_of_rows_with_missing_data))
if any(recipients.rows_with_message_too_long):
number_of_rows_with_message_too_long = len(list(recipients.rows_with_message_too_long))
if 1 == number_of_rows_with_message_too_long:
errors.append("shorten your message in 1 row")
else:
errors.append("shorten your message in {} rows".format(number_of_rows_with_missing_data))
if any(recipients.rows_with_empty_message):
number_of_rows_with_empty_message = len(list(recipients.rows_with_empty_message))
if 1 == number_of_rows_with_empty_message:
errors.append("add content to empty message in 1 row")
else:
errors.append("add content to empty messages {} rows".format(number_of_rows_with_empty_message))
return errors