mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-07-28 11:49:13 -04:00
Refactor summaries into model
This lets us encapsulate some of the logic that’s currently cluttering up the view/template layer.
This commit is contained in:
@@ -480,6 +480,12 @@ class Service(JSONModel):
|
||||
def has_inbound_number(self):
|
||||
return bool(self.inbound_number)
|
||||
|
||||
@cached_property
|
||||
def inbound_sms_summary(self):
|
||||
if not self.has_permission('inbound_sms'):
|
||||
return None
|
||||
return service_api_client.get_inbound_sms_summary(self.id)
|
||||
|
||||
@cached_property
|
||||
def all_template_folders(self):
|
||||
return sorted(
|
||||
@@ -660,3 +666,7 @@ class Service(JSONModel):
|
||||
):
|
||||
if test:
|
||||
yield BASE + '_incomplete' + tag
|
||||
|
||||
@cached_property
|
||||
def returned_letter_summary(self):
|
||||
return service_api_client.get_returned_letter_summary(self.id)
|
||||
|
||||
Reference in New Issue
Block a user