Add template hidden field in response

This commit is contained in:
Ken Tsang
2018-03-05 13:38:41 +00:00
parent ee9b6f1fe0
commit 564504bf97
7 changed files with 15 additions and 3 deletions

View File

@@ -83,6 +83,7 @@ def dao_get_template_usage(service_id, limit_days=None):
Template.id.label('template_id'),
Template.name,
Template.template_type,
Template.hidden,
notifications_aggregate_query.c.count
).join(
notifications_aggregate_query,

View File

@@ -522,6 +522,7 @@ def dao_fetch_monthly_historical_usage_by_template_for_service(service_id, year)
stat.month = result.month
stat.year = result.year
stat.count = result.count
stat.hidden = result.hidden
stats.append(stat)
month = get_london_month_from_utc_column(Notification.created_at)
@@ -533,6 +534,7 @@ def dao_fetch_monthly_historical_usage_by_template_for_service(service_id, year)
if fy_start < datetime.now() < fy_end:
today_results = db.session.query(
Notification.template_id,
Template.hidden,
Template.name,
Template.template_type,
extract('month', month).label('month'),
@@ -547,6 +549,7 @@ def dao_fetch_monthly_historical_usage_by_template_for_service(service_id, year)
Notification.key_type != KEY_TYPE_TEST
).group_by(
Notification.template_id,
Template.hidden,
Template.name,
Template.template_type,
month,
@@ -571,6 +574,7 @@ def dao_fetch_monthly_historical_usage_by_template_for_service(service_id, year)
new_stat.month = int(today_result.month)
new_stat.year = int(today_result.year)
new_stat.count = today_result.count
new_stat.hidden = today_result.hidden
stats.append(new_stat)
return stats

View File

@@ -35,6 +35,7 @@ def insert_or_update_stats_for_template(template_id, month, year, count):
def dao_get_template_usage_stats_by_service(service_id, year):
return db.session.query(
StatsTemplateUsageByMonth.template_id,
Template.hidden,
Template.name,
Template.template_type,
StatsTemplateUsageByMonth.month,

View File

@@ -135,6 +135,7 @@ def dao_get_templates_for_cache(cache):
query = db.session.query(Template.id.label('template_id'),
Template.template_type,
Template.name,
Template.hidden,
cache_subq.c.count.label('count')
).join(cache_subq,
Template.id == cache_subq.c.template_id