Skip to content

Commit 68bcfe8

Browse files
authored
Reverting notification history (#2102)
1 parent 25229a2 commit 68bcfe8

File tree

2 files changed

+14
-21
lines changed

2 files changed

+14
-21
lines changed

app/dao/fact_notification_status_dao.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -362,14 +362,7 @@ def get_last_send_for_api_key(api_key_id):
362362
.filter(Notification.api_key_id == api_key_id)
363363
.all()
364364
)
365-
if not notification_table[0][0]:
366-
notification_table = (
367-
db.session.query(func.max(NotificationHistory.created_at).label("last_notification_created"))
368-
.filter(NotificationHistory.api_key_id == api_key_id)
369-
.all()
370-
)
371-
notification_table = [] if notification_table[0][0] is None else notification_table
372-
return notification_table
365+
return [] if notification_table[0][0] is None else notification_table
373366
return api_key_table
374367

375368

tests/app/dao/test_fact_notification_status_dao.py

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -423,24 +423,24 @@ def test_get_api_key_ranked_by_notifications_created(notify_db_session):
423423
assert int(second_place[8]) == sms_sends
424424

425425

426-
def test_last_used_for_api_key(notify_db_session):
427-
service = create_service(service_name="Service 1")
428-
api_key_1 = create_api_key(service, key_type=KEY_TYPE_NORMAL, key_name="Key 1")
429-
api_key_2 = create_api_key(service, key_type=KEY_TYPE_NORMAL, key_name="Key 2")
430-
api_key_3 = create_api_key(service, key_type=KEY_TYPE_NORMAL, key_name="Key 3")
431-
template_email = create_template(service=service, template_type="email")
432-
create_notification_history(template=template_email, api_key=api_key_1, created_at="2022-03-04")
433-
save_notification(create_notification(template=template_email, api_key=api_key_1, created_at="2022-03-05"))
426+
# def test_last_used_for_api_key(notify_db_session):
427+
# service = create_service(service_name="Service 1")
428+
# api_key_1 = create_api_key(service, key_type=KEY_TYPE_NORMAL, key_name="Key 1")
429+
# api_key_2 = create_api_key(service, key_type=KEY_TYPE_NORMAL, key_name="Key 2")
430+
# api_key_3 = create_api_key(service, key_type=KEY_TYPE_NORMAL, key_name="Key 3")
431+
# template_email = create_template(service=service, template_type="email")
432+
# create_notification_history(template=template_email, api_key=api_key_1, created_at="2022-03-04")
433+
# save_notification(create_notification(template=template_email, api_key=api_key_1, created_at="2022-03-05"))
434434

435-
assert (get_last_send_for_api_key(str(api_key_1.id))[0][0]).strftime("%Y-%m-%d") == "2022-03-05"
435+
# assert (get_last_send_for_api_key(str(api_key_1.id))[0][0]).strftime("%Y-%m-%d") == "2022-03-05"
436436

437-
save_notification(create_notification(template=template_email, api_key=api_key_2, created_at="2022-03-06"))
437+
# save_notification(create_notification(template=template_email, api_key=api_key_2, created_at="2022-03-06"))
438438

439-
assert (get_last_send_for_api_key(str(api_key_2.id))[0][0]).strftime("%Y-%m-%d") == "2022-03-06"
439+
# assert (get_last_send_for_api_key(str(api_key_2.id))[0][0]).strftime("%Y-%m-%d") == "2022-03-06"
440440

441-
create_notification_history(template=template_email, api_key=api_key_3, created_at="2022-03-07")
441+
# create_notification_history(template=template_email, api_key=api_key_3, created_at="2022-03-07")
442442

443-
assert (get_last_send_for_api_key(str(api_key_3.id))[0][0]).strftime("%Y-%m-%d") == "2022-03-07"
443+
# assert (get_last_send_for_api_key(str(api_key_3.id))[0][0]).strftime("%Y-%m-%d") == "2022-03-07"
444444

445445

446446
@pytest.mark.parametrize(

0 commit comments

Comments
 (0)