Move request to go live notes into template

We can make the `as_agreement_statement_for_go_live_request` method less
complex by offloading some of the content it returns to the presentation
layer.
This commit is contained in:
Chris Hill-Scott
2021-10-11 15:05:15 +01:00
parent ec703c5998
commit 1ab83c48e3
2 changed files with 5 additions and 10 deletions

View File

@@ -103,9 +103,9 @@ class Organisation(JSONModel):
def as_agreement_statement_for_go_live_request(self, fallback_domain):
if self.agreement_signed:
agreement_statement = 'Yes, on behalf of {}.'.format(self.name)
elif self.name:
agreement_statement = '{} (organisation is {}, {}).'.format(
return 'Yes, on behalf of {}.'.format(self.name)
if self.name:
return '{} (organisation is {}, {}).'.format(
{
False: 'No',
None: 'Cant tell',
@@ -117,13 +117,7 @@ class Organisation(JSONModel):
None: 'crown status unknown',
}.get(self.crown),
)
else:
agreement_statement = 'Cant tell (domain is {}).'.format(fallback_domain)
if self.request_to_go_live_notes:
agreement_statement = agreement_statement + ' ' + self.request_to_go_live_notes
return agreement_statement
return 'Cant tell (domain is {}).'.format(fallback_domain)
def as_info_for_branding_request(self, fallback_domain):
return self.name or 'Cant tell (domain is {})'.format(fallback_domain)

View File

@@ -4,6 +4,7 @@ Service: {{ current_service.name }}
---
Organisation type: {{ current_service.organisation_type_label }}
Agreement signed: {{ current_service.organisation.as_agreement_statement_for_go_live_request(current_user.email_domain) }}
{%- if current_service.organisation.request_to_go_live_notes %} {{ current_service.organisation.request_to_go_live_notes }}{% endif %}
{%- if current_service.organisation.agreement_signed_by %}
Agreement signed by: {{ current_service.organisation.agreement_signed_by.email_address }}
{% endif -%}