Merge pull request #2211 from alphagov/fix_notification_statistics_on_dashboard

Fix notification statistics on dashboard
This commit is contained in:
Pea (Malgorzata Tyczynska)
2018-11-06 16:22:00 +00:00
committed by GitHub
5 changed files with 92 additions and 12 deletions

View File

@@ -20,7 +20,8 @@ from app.dao.api_key_dao import (
expire_api_key)
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_day,
fetch_notification_status_for_service_for_today_and_7_previous_days
)
from app.dao.inbound_numbers_dao import dao_allocate_number_for_service
from app.dao.organisation_dao import dao_get_organisation_by_service_id
@@ -47,7 +48,6 @@ from app.dao.services_dao import (
dao_fetch_all_services_by_user,
dao_fetch_monthly_historical_usage_by_template_for_service,
dao_fetch_service_by_id,
dao_fetch_stats_for_service,
dao_fetch_todays_stats_for_service,
dao_fetch_todays_stats_for_all_services,
dao_resume_service,
@@ -433,7 +433,7 @@ def get_service_statistics(service_id, today_only, limit_days=7):
if today_only:
stats = dao_fetch_todays_stats_for_service(service_id)
else:
stats = dao_fetch_stats_for_service(service_id, limit_days=limit_days)
stats = fetch_notification_status_for_service_for_today_and_7_previous_days(service_id, limit_days=limit_days)
return statistics.format_statistics(stats)