mirror of
https://github.com/GSA/notifications-api.git
synced 2026-09-06 23:08:24 -04:00
Removing total_notification calculations.
Signed-off-by: Cliff Hill <Clifford.hill@gsa.gov>
This commit is contained in:
@@ -230,18 +230,13 @@ def get_service_statistics_for_specific_days(service_id, start, days=1):
|
||||
end_date = datetime.strptime(start, "%Y-%m-%d")
|
||||
start_date = end_date - timedelta(days=days - 1)
|
||||
|
||||
total_notifications, results = dao_fetch_stats_for_service_from_days(
|
||||
results = dao_fetch_stats_for_service_from_days(
|
||||
service_id,
|
||||
start_date,
|
||||
end_date,
|
||||
)
|
||||
|
||||
stats = get_specific_days_stats(
|
||||
results,
|
||||
start_date,
|
||||
days=days,
|
||||
total_notifications=total_notifications,
|
||||
)
|
||||
stats = get_specific_days_stats(results, start_date, days=days)
|
||||
|
||||
return stats
|
||||
|
||||
|
||||
@@ -5,13 +5,12 @@ from app.dao.date_util import get_months_for_financial_year
|
||||
from app.enums import (
|
||||
KeyType,
|
||||
NotificationStatus,
|
||||
NotificationType,
|
||||
StatisticsType,
|
||||
TemplateType,
|
||||
)
|
||||
|
||||
|
||||
def format_statistics(statistics, total_notifications=None):
|
||||
def format_statistics(statistics):
|
||||
# statistics come in a named tuple with uniqueness from 'notification_type', 'status' - however missing
|
||||
# statuses/notification types won't be represented and the status types need to be simplified/summed up
|
||||
# so we can return emails/sms * created, sent, and failed
|
||||
@@ -25,17 +24,6 @@ def format_statistics(statistics, total_notifications=None):
|
||||
row,
|
||||
)
|
||||
|
||||
# Update pending count directly
|
||||
if NotificationType.SMS in counts and total_notifications is not None:
|
||||
sms_dict = counts[NotificationType.SMS]
|
||||
requested_count = sms_dict[StatisticsType.REQUESTED]
|
||||
delivered_count = sms_dict[StatisticsType.DELIVERED]
|
||||
failed_count = sms_dict[StatisticsType.FAILURE]
|
||||
pending_count = total_notifications - (
|
||||
requested_count + delivered_count + failed_count
|
||||
)
|
||||
sms_dict[StatisticsType.PENDING] = pending_count
|
||||
|
||||
return counts
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user