More changes for enums.

Signed-off-by: Cliff Hill <Clifford.hill@gsa.gov>
This commit is contained in:
Cliff Hill
2024-02-28 12:41:57 -05:00
parent 820ee5a942
commit 43f18eed6a
24 changed files with 157 additions and 111 deletions

View File

@@ -13,11 +13,11 @@ from app.models import (
KEY_TYPE_TEAM,
NOTIFICATION_STATUS_TYPES_BILLABLE_SMS,
NOTIFICATION_STATUS_TYPES_SENT_EMAILS,
NotificationType,
AnnualBilling,
FactBilling,
NotificationAllTimeView,
NotificationHistory,
NotificationType,
Organization,
Rate,
Service,
@@ -483,7 +483,9 @@ def get_service_ids_that_need_billing_populated(start_date, end_date):
.filter(
NotificationHistory.created_at >= start_date,
NotificationHistory.created_at <= end_date,
NotificationHistory.notification_type.in_([NotificationType.SMS, NotificationType.EMAIL]),
NotificationHistory.notification_type.in_(
[NotificationType.SMS, NotificationType.EMAIL]
),
NotificationHistory.billable_units != 0,
)
.distinct()

View File

@@ -6,9 +6,9 @@ from sqlalchemy.orm import aliased
from app import db
from app.dao.dao_utils import autocommit
from app.models import (
NotificationType,
InboundSms,
InboundSmsHistory,
NotificationType,
Service,
ServiceDataRetention,
)

View File

@@ -26,10 +26,10 @@ from app.models import (
NOTIFICATION_SENDING,
NOTIFICATION_SENT,
NOTIFICATION_TEMPORARY_FAILURE,
NotificationType,
FactNotificationStatus,
Notification,
NotificationHistory,
NotificationType,
)
from app.utils import (
escape_special_characters,
@@ -444,7 +444,9 @@ def dao_timeout_notifications(cutoff_time, limit=100000):
Notification.query.filter(
Notification.created_at < cutoff_time,
Notification.status.in_(current_statuses),
Notification.notification_type.in_([NotificationType.SMS, NotificationType.EMAIL]),
Notification.notification_type.in_(
[NotificationType.SMS, NotificationType.EMAIL]
),
)
.limit(limit)
.all()
@@ -506,7 +508,9 @@ def dao_get_notifications_by_recipient_or_reference(
normalised = "".join(search_term.split()).lower()
else:
raise TypeError(f"Notification type must be {NotificationType.EMAIL}, {NotificationType.SMS}, or None")
raise TypeError(
f"Notification type must be {NotificationType.EMAIL}, {NotificationType.SMS}, or None"
)
normalised = escape_special_characters(normalised)
search_term = escape_special_characters(search_term)

View File

@@ -6,8 +6,8 @@ from sqlalchemy import asc, desc, func
from app import db
from app.dao.dao_utils import autocommit
from app.models import (
NotificationType,
FactBilling,
NotificationType,
ProviderDetails,
ProviderDetailsHistory,
User,

View File

@@ -8,10 +8,10 @@ from app import db
from app.models import (
JOB_STATUS_CANCELLED,
JOB_STATUS_SCHEDULED,
NotificationType,
NOTIFICATION_CANCELLED,
Job,
Notification,
NotificationType,
ServiceDataRetention,
Template,
)