Skip to content

Commit

Permalink
Merge branch 'main' into fix/update-get_notifications_for_service
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewleith authored Sep 27, 2024
2 parents a2cbd9c + 96ef9a8 commit edb7c74
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions app/dao/notifications_dao.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import functools
import string
from datetime import datetime, time, timedelta, timezone
from datetime import datetime, timedelta

from flask import current_app
from itsdangerous import BadSignature
Expand Down Expand Up @@ -384,7 +384,7 @@ def delete_notifications_older_than_retention_by_type(notification_type, qry_lim
flexible_data_retention = ServiceDataRetention.query.filter(ServiceDataRetention.notification_type == notification_type).all()
deleted = 0
for f in flexible_data_retention:
days_of_retention = datetime.combine(datetime.now(timezone.utc) - timedelta(days=f.days_of_retention), time.max)
days_of_retention = get_query_date_based_on_retention_period(f.days_of_retention)

insert_update_notification_history(notification_type, days_of_retention, f.service_id)

Expand All @@ -397,7 +397,7 @@ def delete_notifications_older_than_retention_by_type(notification_type, qry_lim

current_app.logger.info("Deleting {} notifications for services without flexible data retention".format(notification_type))

seven_days_ago = datetime.combine(datetime.now(timezone.utc) - timedelta(days=7), time.max)
seven_days_ago = get_query_date_based_on_retention_period(7)
services_with_data_retention = [x.service_id for x in flexible_data_retention]
service_ids_to_purge = db.session.query(Service.id).filter(Service.id.notin_(services_with_data_retention)).all()

Expand Down

0 comments on commit edb7c74

Please sign in to comment.