Let people go live without filling the volumes

At the moment it 500s because it can’t format the `None` values as
numbers.

In the future we will stop people requesting to go live until they’ve
provided this info. For now it has to be optional.
This commit is contained in:
Chris Hill-Scott
2019-02-27 17:05:02 +00:00
parent 852ae037d1
commit 5f4280cf81
2 changed files with 56 additions and 12 deletions

View File

@@ -201,9 +201,9 @@ def submit_request_to_go_live(service_id):
'\nOrganisation type: {organisation_type}'
'\nAgreement signed: {agreement}'
'\nChecklist completed: {checklist}'
'\nEmails in next year: {volume_email:,.0f}'
'\nText messages in next year: {volume_sms:,.0f}'
'\nLetters in next year: {volume_letter:,.0f}'
'\nEmails in next year: {volume_email_formatted}'
'\nText messages in next year: {volume_sms_formatted}'
'\nLetters in next year: {volume_letter_formatted}'
'\nConsent to research: {research_consent}'
'\nOther live services: {existing_live}'
'\n'
@@ -225,9 +225,12 @@ def submit_request_to_go_live(service_id):
organisation_type=str(current_service.organisation_type).title(),
agreement=AgreementInfo.from_current_user().as_human_readable,
checklist=current_service.go_live_checklist_completed_as_yes_no,
volume_email=current_service.volume_email,
volume_sms=current_service.volume_sms,
volume_letter=current_service.volume_letter,
volume_email=print_if_number(current_service.volume_email),
volume_email_formatted=format_if_number(current_service.volume_email),
volume_sms=print_if_number(current_service.volume_sms),
volume_sms_formatted=format_if_number(current_service.volume_sms),
volume_letter=print_if_number(current_service.volume_letter),
volume_letter_formatted=format_if_number(current_service.volume_letter),
research_consent='Yes' if current_service.consent_to_research else 'No',
existing_live='Yes' if user_api_client.user_has_live_services(current_user) else 'No',
service_id=current_service.id,
@@ -1070,3 +1073,11 @@ def _get_request_to_go_live_tags(service, agreement_signed):
):
if test:
yield BASE + '_incomplete' + tag
def print_if_number(value):
return value if isinstance(value, int) else ''
def format_if_number(value):
return '{:,.0f}'.format(value) if isinstance(value, int) else ''