mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-20 07:21:13 -05:00
Create a new query for template monthly stats.
This commit is contained in:
@@ -24,7 +24,8 @@ from app.dao.fact_notification_status_dao import (
|
||||
fetch_notification_status_for_service_by_month,
|
||||
fetch_notification_status_for_service_for_day,
|
||||
fetch_notification_status_for_service_for_today_and_7_previous_days,
|
||||
fetch_stats_for_all_services_by_date_range)
|
||||
fetch_stats_for_all_services_by_date_range, fetch_monthly_template_usage_for_service
|
||||
)
|
||||
from app.dao.inbound_numbers_dao import dao_allocate_number_for_service
|
||||
from app.dao.organisation_dao import dao_get_organisation_by_service_id
|
||||
from app.dao.service_data_retention_dao import (
|
||||
@@ -579,10 +580,16 @@ def resume_service(service_id):
|
||||
@service_blueprint.route('/<uuid:service_id>/notifications/templates_usage/monthly', methods=['GET'])
|
||||
def get_monthly_template_usage(service_id):
|
||||
try:
|
||||
data = dao_fetch_monthly_historical_usage_by_template_for_service(
|
||||
service_id,
|
||||
int(request.args.get('year', 'NaN'))
|
||||
start_date, end_date = get_financial_year(int(request.args.get('year', 'NaN')))
|
||||
data = fetch_monthly_template_usage_for_service(
|
||||
start_date=start_date,
|
||||
end_date=end_date,
|
||||
service_id=service_id
|
||||
)
|
||||
# data = dao_fetch_monthly_historical_usage_by_template_for_service(
|
||||
# service_id,
|
||||
# int(request.args.get('year', 'NaN'))
|
||||
# )
|
||||
|
||||
stats = list()
|
||||
for i in data:
|
||||
|
||||
Reference in New Issue
Block a user