mirror of
https://github.com/GSA/notifications-api.git
synced 2026-09-05 15:18:26 -04:00
use only convert_utc_to_local_timezone
This commit is contained in:
@@ -5,7 +5,7 @@ from flask import current_app
|
|||||||
from notifications_utils.clients.zendesk.zendesk_client import (
|
from notifications_utils.clients.zendesk.zendesk_client import (
|
||||||
NotifySupportTicket,
|
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 import func
|
||||||
from sqlalchemy.exc import SQLAlchemyError
|
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:
|
for f in flexible_data_retention:
|
||||||
day_to_delete_backwards_from = get_local_midnight_in_utc(
|
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={
|
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
|
'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}
|
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.
|
# get a list of all service ids that we'll need to delete for. Typically that might only be 5% of services.
|
||||||
|
|||||||
Reference in New Issue
Block a user