Allow for empty live_date field in live services csv reports

Earlier the report broke if there were services with an empty
live date
This commit is contained in:
Pea Tyczynska
2019-05-01 18:29:51 +01:00
parent 8c1f2298a8
commit 0755e81c09
2 changed files with 10 additions and 6 deletions

View File

@@ -219,7 +219,9 @@ def live_services_csv():
row["contact_name"],
row["contact_email"],
row["contact_mobile"],
datetime.strptime(row["live_date"], '%a, %d %b %Y %X %Z').strftime("%d-%m-%Y"),
datetime.strptime(
row["live_date"], '%a, %d %b %Y %X %Z'
).strftime("%d-%m-%Y") if row["live_date"] else None,
row["sms_volume_intent"],
row["email_volume_intent"],
row["letter_volume_intent"],
@@ -249,7 +251,9 @@ def performance_platform_csv():
row["service_id"],
row["organisation_name"],
row["service_name"],
datetime.strptime(row["live_date"], '%a, %d %b %Y %X %Z').strftime("%Y-%m-%dT%H:%M:%S") + "Z",
datetime.strptime(
row["live_date"], '%a, %d %b %Y %X %Z'
).strftime("%Y-%m-%dT%H:%M:%S") + "Z" if row["live_date"] else None,
"govuk-notify",
1
])