rename days_ago to midnight_n_days_ago

also add some more timezone boundary tests and minor code cleanup
This commit is contained in:
Leo Hemsted
2018-04-30 11:50:56 +01:00
parent 310b8eda4c
commit 0efa223fb2
6 changed files with 54 additions and 25 deletions

View File

@@ -81,7 +81,7 @@ def cache_key_for_service_template_counter(service_id, limit_days=7):
def cache_key_for_service_template_usage_per_day(service_id, datetime):
"""
You should probably pass a BST datetime into this function
You should pass a BST datetime into this function
"""
return "service-{}-template-usage-{}".format(service_id, datetime.date().isoformat())
@@ -95,7 +95,7 @@ def get_public_notify_type_text(notify_type, plural=False):
return '{}{}'.format(notify_type_text, 's' if plural else '')
def days_ago(number_of_days):
def midnight_n_days_ago(number_of_days):
"""
Returns midnight a number of days ago. Takes care of daylight savings etc.
"""