Update /platform-stats to return the data from ft_notification_status, that way the request should not time out for a long date range.

Next steps is to update the query for platform admin stats for all services.
This commit is contained in:
Rebecca Law
2018-12-03 13:59:25 +00:00
parent 7ec3dbd667
commit c766febe94
4 changed files with 120 additions and 6 deletions

View File

@@ -2,7 +2,7 @@ from datetime import datetime
from flask import Blueprint, jsonify, request
from app.dao.notifications_dao import fetch_aggregate_stats_by_date_range_for_all_services
from app.dao.fact_notification_status_dao import fetch_notification_status_totals_for_all_services
from app.errors import register_errors
from app.platform_stats.platform_stats_schema import platform_stats_request
from app.service.statistics import format_admin_stats
@@ -23,7 +23,7 @@ def get_platform_stats():
start_date = datetime.strptime(request.args.get('start_date', today), '%Y-%m-%d').date()
end_date = datetime.strptime(request.args.get('end_date', today), '%Y-%m-%d').date()
data = fetch_aggregate_stats_by_date_range_for_all_services(start_date=start_date, end_date=end_date)
data = fetch_notification_status_totals_for_all_services(start_date=start_date, end_date=end_date)
stats = format_admin_stats(data)
return jsonify(stats)