use only convert_utc_to_local_timezone

This commit is contained in:
stvnrlly
2022-11-16 12:51:46 -05:00
parent 53019995d1
commit 6908bd3cf5

View File

@@ -5,7 +5,7 @@ from flask import current_app
from notifications_utils.clients.zendesk.zendesk_client import (
NotifySupportTicket,
)
from notifications_utils.timezones import convert_utc_to_est
from notifications_utils.timezones import convert_utc_to_local_timezone
from sqlalchemy import func
from sqlalchemy.exc import SQLAlchemyError
@@ -91,7 +91,7 @@ def _delete_notifications_older_than_retention_by_type(notification_type):
for f in flexible_data_retention:
day_to_delete_backwards_from = get_local_midnight_in_utc(
convert_utc_to_est(datetime.utcnow()).date() - timedelta(days=f.days_of_retention)
convert_utc_to_local_timezone(datetime.utcnow()).date() - timedelta(days=f.days_of_retention)
)
delete_notifications_for_service_and_type.apply_async(queue=QueueNames.REPORTING, kwargs={
@@ -100,7 +100,7 @@ def _delete_notifications_older_than_retention_by_type(notification_type):
'datetime_to_delete_before': day_to_delete_backwards_from
})
seven_days_ago = get_local_midnight_in_utc(convert_utc_to_est(datetime.utcnow()).date() - timedelta(days=7))
seven_days_ago = get_local_midnight_in_utc(convert_utc_to_local_timezone(datetime.utcnow()).date() - timedelta(days=7))
service_ids_with_data_retention = {x.service_id for x in flexible_data_retention}
# get a list of all service ids that we'll need to delete for. Typically that might only be 5% of services.