Fix incorrect processing started time on jobs

We were doing the UTC to BST conversion twice, meaning the job was shown
as being started 2 hours later than UTC, and 1 hour later than actual
BST.
This commit is contained in:
Chris Hill-Scott
2020-09-28 14:53:42 +01:00
parent 65e32f8e5a
commit 86ec9430a2
2 changed files with 5 additions and 3 deletions

View File

@@ -67,7 +67,7 @@ class Job(JSONModel):
def processing_started(self):
if not self._dict.get('processing_started'):
return None
return utc_string_to_aware_gmt_datetime(self._dict['processing_started'])
return self._dict['processing_started']
def _aggregate_statistics(self, *statuses):
return sum(
@@ -124,7 +124,9 @@ class Job(JSONModel):
# notifications yet
return True
return (
datetime.utcnow().astimezone(local_timezone) - self.processing_started
datetime.utcnow().astimezone(local_timezone) - utc_string_to_aware_gmt_datetime(
self.processing_started
)
).days < 1
@property

View File

@@ -706,7 +706,7 @@ def test_should_show_updates_for_scheduled_job_as_json(
assert 'Status' in content['notifications']
assert 'Delivered' in content['notifications']
assert '12:01am' in content['notifications']
assert 'Sent by Test User on 1 June at 5:00pm' in content['status']
assert 'Sent by Test User on 1 June at 4:00pm' in content['status']
@pytest.mark.parametrize(