mirror of
https://github.com/GSA/notifications-api.git
synced 2025-12-21 07:51:13 -05:00
try using vanilla sql for problematic query
This commit is contained in:
@@ -271,17 +271,28 @@ def _filter_query(query, filter_dict=None):
|
|||||||
return query
|
return query
|
||||||
|
|
||||||
|
|
||||||
|
@autocommit
|
||||||
def sanitize_successful_notification_by_id(
|
def sanitize_successful_notification_by_id(
|
||||||
notification_id
|
notification_id
|
||||||
):
|
):
|
||||||
# TODO what to do for international?
|
# TODO what to do for international?
|
||||||
phone_prefix = '1'
|
# phone_prefix = '1'
|
||||||
Notification.query.filter(
|
# Notification.query.filter(
|
||||||
Notification.id.in_([notification_id]),
|
# Notification.id.in_([notification_id]),
|
||||||
).update(
|
# ).update(
|
||||||
{'to': phone_prefix, 'normalised_to': phone_prefix, 'status': 'delivered'}
|
# {'to': phone_prefix, 'normalised_to': phone_prefix, 'status': 'delivered'}
|
||||||
)
|
# )
|
||||||
db.session.commit()
|
# db.session.commit()
|
||||||
|
|
||||||
|
update_query = """
|
||||||
|
update notifications set notification_status='delivered', "to"='1', normalised_to='1'
|
||||||
|
where id=:notification_id
|
||||||
|
"""
|
||||||
|
input_params = {
|
||||||
|
"notification_id": notification_id
|
||||||
|
}
|
||||||
|
|
||||||
|
db.session.execute(update_query, input_params)
|
||||||
|
|
||||||
|
|
||||||
@autocommit
|
@autocommit
|
||||||
|
|||||||
Reference in New Issue
Block a user