mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-20 15:31:15 -05:00
@@ -2,7 +2,7 @@ from collections import defaultdict
|
||||
from datetime import datetime
|
||||
|
||||
from app.dao.date_util import get_months_for_financial_year
|
||||
from app.enums import NotificationStatus, StatisticsType, TemplateType
|
||||
from app.enums import KeyType, NotificationStatus, StatisticsType, TemplateType
|
||||
|
||||
|
||||
def format_statistics(statistics):
|
||||
@@ -23,7 +23,7 @@ def format_admin_stats(statistics):
|
||||
counts = create_stats_dict()
|
||||
|
||||
for row in statistics:
|
||||
if row.key_type == "test":
|
||||
if row.key_type == KeyType.TEST:
|
||||
counts[row.notification_type]["test-key"] += row.count
|
||||
else:
|
||||
counts[row.notification_type]["total"] += row.count
|
||||
|
||||
@@ -7,6 +7,7 @@ from sqlalchemy.exc import DataError
|
||||
from sqlalchemy.orm.exc import NoResultFound
|
||||
|
||||
from app.authentication.auth import AuthError
|
||||
from app.enums import KeyType
|
||||
from app.errors import InvalidRequest
|
||||
|
||||
|
||||
@@ -35,7 +36,7 @@ class RateLimitError(InvalidRequest):
|
||||
def __init__(self, sending_limit, interval, key_type):
|
||||
# normal keys are spoken of as "live" in the documentation
|
||||
# so using this in the error messaging
|
||||
if key_type == "normal":
|
||||
if key_type == KeyType.NORMAL:
|
||||
key_type = "live"
|
||||
|
||||
self.message = self.message_template.format(
|
||||
|
||||
Reference in New Issue
Block a user