Fix issue where row_number starts from 3 on a job report download

This commit is contained in:
Imdad Ahad
2017-01-19 10:42:58 +00:00
parent dfc751ef02
commit 6a48325b3b
2 changed files with 32 additions and 1 deletions

View File

@@ -164,8 +164,15 @@ def generate_notifications_csv(**kwargs):
def format_notification_for_csv(notification):
from app import format_datetime_24h, format_notification_status
# row_number can be 0 so we need to check for it
row_num = notification.get('job_row_number')
if row_num is not None and row_num >= 0:
row_num += 1
else:
row_num = ''
return {
'Row number': int(notification['job_row_number']) + 2 if notification.get('job_row_number') else '',
'Row number': row_num,
'Recipient': notification['to'],
'Template': notification['template']['name'],
'Type': notification['template']['template_type'],