Add a page to show delivery rates week-by-week

Implements
https://github.com/alphagov/notifications-api/pull/286

Will always show weeks as Monday to Sunday.
This commit is contained in:
Chris Hill-Scott
2016-05-03 13:25:22 +01:00
parent afc8fb08f3
commit 50427ecd3f
13 changed files with 170 additions and 35 deletions

View File

@@ -101,6 +101,7 @@ def create_app():
application.add_template_filter(valid_phone_number)
application.add_template_filter(linkable_name)
application.add_template_filter(format_date)
application.add_template_filter(format_date_short)
application.after_request(useful_headers_after_request)
application.after_request(save_service_after_request)
@@ -201,6 +202,11 @@ def format_date(date):
return date.strftime('%A %d %B %Y')
def format_date_short(date):
date = dateutil.parser.parse(date)
return date.strftime('%d %B').lstrip('0')
def valid_phone_number(phone_number):
try:
validate_phone_number(phone_number)