mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-20 22:40:31 -04:00
Refactor to reduce nesting and repetition
This commit is contained in:
@@ -345,6 +345,10 @@ class Service(dict):
|
||||
self.id
|
||||
))
|
||||
|
||||
@property
|
||||
def needs_to_add_email_reply_to_address(self):
|
||||
return self.has_email_templates and not self.has_email_reply_to_address
|
||||
|
||||
@property
|
||||
def shouldnt_use_govuk_as_sms_sender(self):
|
||||
return self.organisation_type in {'local', 'nhs'}
|
||||
@@ -356,20 +360,21 @@ class Service(dict):
|
||||
service_api_client.get_sms_senders(self.id)
|
||||
) in {'GOVUK', 'None'}
|
||||
|
||||
@property
|
||||
def needs_to_change_sms_sender(self):
|
||||
return all((
|
||||
self.has_sms_templates,
|
||||
self.shouldnt_use_govuk_as_sms_sender,
|
||||
self.sms_sender_is_govuk,
|
||||
))
|
||||
|
||||
@property
|
||||
def go_live_checklist_completed(self):
|
||||
return all((
|
||||
self.has_team_members,
|
||||
self.has_templates,
|
||||
any((
|
||||
not self.has_email_templates,
|
||||
self.has_email_reply_to_address,
|
||||
)),
|
||||
any((
|
||||
not self.has_sms_templates,
|
||||
not self.shouldnt_use_govuk_as_sms_sender,
|
||||
not self.sms_sender_is_govuk,
|
||||
))
|
||||
not self.needs_to_add_email_reply_to_address,
|
||||
not self.needs_to_change_sms_sender,
|
||||
))
|
||||
|
||||
@property
|
||||
|
||||
Reference in New Issue
Block a user