Refactor is_precompiled_letter to model

This commit is contained in:
Ken Tsang
2018-03-07 15:42:59 +00:00
parent 28136734e4
commit 7011b90bd4
16 changed files with 126 additions and 62 deletions

View File

@@ -68,7 +68,7 @@ from app.errors import (
InvalidRequest,
register_errors
)
from app.models import Service, EmailBranding
from app.models import Service, EmailBranding, LETTER_TYPE, PRECOMPILED_TEMPLATE_NAME
from app.schema_validation import validate
from app.service import statistics
from app.service.service_senders_schema import (
@@ -538,9 +538,9 @@ def get_monthly_template_usage(service_id):
'year': i.year,
'count': i.count,
'precompiled_letter': (
i.template_type == 'letter' and
i.template_type == LETTER_TYPE and
i.hidden and
i.name == current_app.config['PRECOMPILED_TEMPLATE_NAME']
i.name == PRECOMPILED_TEMPLATE_NAME
)
}
)