mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-23 07:46:06 -04:00
Update response to return is_precompiled_letter
This commit is contained in:
@@ -305,7 +305,6 @@ class NotificationModelSchema(BaseSchema):
|
|||||||
class BaseTemplateSchema(BaseSchema):
|
class BaseTemplateSchema(BaseSchema):
|
||||||
reply_to = fields.Method("get_reply_to", allow_none=True)
|
reply_to = fields.Method("get_reply_to", allow_none=True)
|
||||||
reply_to_text = fields.Method("get_reply_to_text", allow_none=True)
|
reply_to_text = fields.Method("get_reply_to_text", allow_none=True)
|
||||||
precompiled_letter = fields.Method("get_precompiled_letter")
|
|
||||||
|
|
||||||
def get_reply_to(self, template):
|
def get_reply_to(self, template):
|
||||||
return template.reply_to
|
return template.reply_to
|
||||||
@@ -313,9 +312,6 @@ class BaseTemplateSchema(BaseSchema):
|
|||||||
def get_reply_to_text(self, template):
|
def get_reply_to_text(self, template):
|
||||||
return template.get_reply_to_text()
|
return template.get_reply_to_text()
|
||||||
|
|
||||||
def get_precompiled_letter(self, template):
|
|
||||||
return template.is_precompiled_letter
|
|
||||||
|
|
||||||
class Meta:
|
class Meta:
|
||||||
model = models.Template
|
model = models.Template
|
||||||
exclude = ("service_id", "jobs", "service_letter_contact_id")
|
exclude = ("service_id", "jobs", "service_letter_contact_id")
|
||||||
@@ -466,7 +462,7 @@ class NotificationWithTemplateSchema(BaseSchema):
|
|||||||
'content',
|
'content',
|
||||||
'subject',
|
'subject',
|
||||||
'redact_personalisation',
|
'redact_personalisation',
|
||||||
'precompiled_letter'
|
'is_precompiled_letter'
|
||||||
],
|
],
|
||||||
dump_only=True
|
dump_only=True
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -68,7 +68,7 @@ from app.errors import (
|
|||||||
InvalidRequest,
|
InvalidRequest,
|
||||||
register_errors
|
register_errors
|
||||||
)
|
)
|
||||||
from app.models import Service, EmailBranding, LETTER_TYPE, PRECOMPILED_TEMPLATE_NAME
|
from app.models import Service, EmailBranding
|
||||||
from app.schema_validation import validate
|
from app.schema_validation import validate
|
||||||
from app.service import statistics
|
from app.service import statistics
|
||||||
from app.service.service_senders_schema import (
|
from app.service.service_senders_schema import (
|
||||||
@@ -537,11 +537,7 @@ def get_monthly_template_usage(service_id):
|
|||||||
'month': i.month,
|
'month': i.month,
|
||||||
'year': i.year,
|
'year': i.year,
|
||||||
'count': i.count,
|
'count': i.count,
|
||||||
'precompiled_letter': (
|
'is_precompiled_letter': i.is_precompiled_letter
|
||||||
i.template_type == LETTER_TYPE and
|
|
||||||
i.hidden and
|
|
||||||
i.name == PRECOMPILED_TEMPLATE_NAME
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -48,7 +48,7 @@ def get_template_statistics_for_service_by_day(service_id):
|
|||||||
'template_id': str(data.template_id),
|
'template_id': str(data.template_id),
|
||||||
'template_name': data.name,
|
'template_name': data.name,
|
||||||
'template_type': data.template_type,
|
'template_type': data.template_type,
|
||||||
'precompiled_letter': data.is_precompiled_letter
|
'is_precompiled_letter': data.is_precompiled_letter
|
||||||
}
|
}
|
||||||
|
|
||||||
return jsonify(data=[serialize(row) for row in stats])
|
return jsonify(data=[serialize(row) for row in stats])
|
||||||
|
|||||||
Reference in New Issue
Block a user