mirror of
https://github.com/GSA/notifications-admin.git
synced 2026-08-26 17:24:23 -04:00
added pending and requested status to monthly stats dict
This commit is contained in:
@@ -24,6 +24,7 @@ from app.utils import (
|
|||||||
DELIVERED_STATUSES,
|
DELIVERED_STATUSES,
|
||||||
FAILURE_STATUSES,
|
FAILURE_STATUSES,
|
||||||
REQUESTED_STATUSES,
|
REQUESTED_STATUSES,
|
||||||
|
SENDING_STATUSES,
|
||||||
service_has_permission,
|
service_has_permission,
|
||||||
)
|
)
|
||||||
from app.utils.csv import Spreadsheet
|
from app.utils.csv import Spreadsheet
|
||||||
@@ -341,6 +342,9 @@ def get_dashboard_partials(service_id):
|
|||||||
service_id, free_sms_fragment_limit=free_sms_allowance
|
service_id, free_sms_fragment_limit=free_sms_allowance
|
||||||
)
|
)
|
||||||
|
|
||||||
|
monthly_stats = format_monthly_stats_to_list(
|
||||||
|
service_api_client.get_monthly_notification_stats(service_id, get_current_financial_year())["data"]
|
||||||
|
)
|
||||||
yearly_usage = billing_api_client.get_annual_usage_for_service(
|
yearly_usage = billing_api_client.get_annual_usage_for_service(
|
||||||
service_id,
|
service_id,
|
||||||
get_current_financial_year(),
|
get_current_financial_year(),
|
||||||
@@ -366,6 +370,7 @@ def get_dashboard_partials(service_id):
|
|||||||
),
|
),
|
||||||
"usage": render_template(
|
"usage": render_template(
|
||||||
"views/dashboard/_usage.html",
|
"views/dashboard/_usage.html",
|
||||||
|
monthly_stats=monthly_stats,
|
||||||
**get_annual_usage_breakdown(yearly_usage, free_sms_allowance),
|
**get_annual_usage_breakdown(yearly_usage, free_sms_allowance),
|
||||||
),
|
),
|
||||||
}
|
}
|
||||||
@@ -424,6 +429,8 @@ def aggregate_status_types(counts_dict):
|
|||||||
"{}_counts".format(message_type): {
|
"{}_counts".format(message_type): {
|
||||||
"failed": sum(stats.get(status, 0) for status in FAILURE_STATUSES),
|
"failed": sum(stats.get(status, 0) for status in FAILURE_STATUSES),
|
||||||
"requested": sum(stats.get(status, 0) for status in REQUESTED_STATUSES),
|
"requested": sum(stats.get(status, 0) for status in REQUESTED_STATUSES),
|
||||||
|
"delivered": sum(stats.get(status, 0) for status in DELIVERED_STATUSES),
|
||||||
|
"pending": sum(stats.get(status, 0) for status in SENDING_STATUSES),
|
||||||
}
|
}
|
||||||
for message_type, stats in counts_dict.items()
|
for message_type, stats in counts_dict.items()
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user