Make ‘Available for…’ text on job page relative

When we say ‘delivery information is available for 7 days’ you have to
infer _when_ the seven days starts. When you come back to the page it
still says ‘available for 7 days’ even if you only have a day left to
download it. This is confusing.

This commit changes the text to be relative to now, eg ‘available for 7
days’, ‘available for 1 day’.

The date is counted to midnight on the seventh day, which is when the
data is actually deleted.
This commit is contained in:
Chris Hill-Scott
2016-07-18 09:05:00 +01:00
parent 52d5841bbe
commit 9a5fbca707
5 changed files with 19 additions and 6 deletions

View File

@@ -1,6 +1,6 @@
import pytest
import uuid
from datetime import datetime, timedelta, date
from datetime import datetime, timedelta, date, timezone
from flask.testing import FlaskClient
from flask import url_for
from flask_login import login_user
@@ -155,7 +155,7 @@ def job_json(service_id,
if template_id is None:
template_id = str(generate_uuid())
if created_at is None:
created_at = str(datetime.utcnow().time())
created_at = str(datetime.now(timezone.utc).strftime('%Y-%m-%dT%H:%M:%S.%f%z'))
if status is None:
status = 'Delivered'
data = {