mirror of
https://github.com/GSA/notifications-api.git
synced 2026-02-01 23:55:58 -05:00
add testing
This commit is contained in:
@@ -211,3 +211,4 @@ class StatisticsType(StrEnum):
|
||||
REQUESTED = "requested"
|
||||
DELIVERED = "delivered"
|
||||
FAILURE = "failure"
|
||||
PENDING = "pending"
|
||||
|
||||
@@ -29,15 +29,18 @@ def format_statistics(statistics, total_notifications=None):
|
||||
sms_dict = counts[NotificationType.SMS]
|
||||
delivered_count = sms_dict[StatisticsType.DELIVERED]
|
||||
failed_count = sms_dict[StatisticsType.FAILURE]
|
||||
pending_count = total_notifications - (delivered_count + failed_count)
|
||||
|
||||
pending_count = max(0, pending_count)
|
||||
|
||||
sms_dict[StatisticsType.PENDING] = pending_count
|
||||
sms_dict[StatisticsType.PENDING] = calculate_pending_stats(
|
||||
delivered_count, failed_count, total_notifications
|
||||
)
|
||||
|
||||
return counts
|
||||
|
||||
|
||||
def calculate_pending_stats(delivered_count, failed_count, total_notifications):
|
||||
pending_count = total_notifications - (delivered_count + failed_count)
|
||||
return max(0, pending_count)
|
||||
|
||||
|
||||
def format_admin_stats(statistics):
|
||||
counts = create_stats_dict()
|
||||
|
||||
|
||||
Reference in New Issue
Block a user