mirror of
https://github.com/GSA/notifications-api.git
synced 2026-08-25 00:33:41 -04:00
rename days_ago_to_start to limit_days
consistency with the rest of the app
This commit is contained in:
@@ -14,14 +14,14 @@ def dao_create_inbound_sms(inbound_sms):
|
|||||||
db.session.add(inbound_sms)
|
db.session.add(inbound_sms)
|
||||||
|
|
||||||
|
|
||||||
def dao_get_inbound_sms_for_service(service_id, limit=None, user_number=None, days_ago_to_start=6):
|
def dao_get_inbound_sms_for_service(service_id, limit=None, user_number=None, limit_days=6):
|
||||||
q = InboundSms.query.filter(
|
q = InboundSms.query.filter(
|
||||||
InboundSms.service_id == service_id
|
InboundSms.service_id == service_id
|
||||||
).order_by(
|
).order_by(
|
||||||
InboundSms.created_at.desc()
|
InboundSms.created_at.desc()
|
||||||
)
|
)
|
||||||
if days_ago_to_start is not None:
|
if limit_days is not None:
|
||||||
start_date = midnight_n_days_ago(days_ago_to_start)
|
start_date = midnight_n_days_ago(limit_days)
|
||||||
q = q.filter(InboundSms.created_at >= start_date)
|
q = q.filter(InboundSms.created_at >= start_date)
|
||||||
|
|
||||||
if user_number:
|
if user_number:
|
||||||
|
|||||||
@@ -121,13 +121,13 @@ def test_should_delete_inbound_sms_according_to_data_retention(notify_db_session
|
|||||||
# four deleted for the 3-day service, two for the default seven days one, one for the 30 day
|
# four deleted for the 3-day service, two for the default seven days one, one for the 30 day
|
||||||
assert deleted_count == 7
|
assert deleted_count == 7
|
||||||
assert {
|
assert {
|
||||||
x.created_at for x in dao_get_inbound_sms_for_service(short_retention_service.id, days_ago_to_start=None)
|
x.created_at for x in dao_get_inbound_sms_for_service(short_retention_service.id, limit_days=None)
|
||||||
} == set(dates[:1])
|
} == set(dates[:1])
|
||||||
assert {
|
assert {
|
||||||
x.created_at for x in dao_get_inbound_sms_for_service(no_retention_service.id, days_ago_to_start=None)
|
x.created_at for x in dao_get_inbound_sms_for_service(no_retention_service.id, limit_days=None)
|
||||||
} == set(dates[:3])
|
} == set(dates[:3])
|
||||||
assert {
|
assert {
|
||||||
x.created_at for x in dao_get_inbound_sms_for_service(long_retention_service.id, days_ago_to_start=None)
|
x.created_at for x in dao_get_inbound_sms_for_service(long_retention_service.id, limit_days=None)
|
||||||
} == set(dates[:4])
|
} == set(dates[:4])
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user