-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FSPT-208 Serialise application date submitted in a guaranteed format #126
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this is a sensible enough approach for the short-term 👍
No tests, nothing, all good 👀
Are we gonna go through and clean up the DB(s) too?
aca5ea0
to
5cd4518
Compare
I'm a bit hesitant to test that marshmallow knows how to serialise JSON but you're right that this addresses a change that caused down stream issues - I've added an assertion on the existing submit tests to avoid that changing without us catching it cf5c9d7 |
5cd4518
to
cf5c9d7
Compare
cf5c9d7
to
5442be2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ also - SQL update as script as discussed
`date_submitted` is stored both in the application table and in the JSON representation of an application used by the assess tool. Marshmallow will serialise the properties from the application model depending on if there is timezone information included or not. Previously the application store was first "submitting" an application (updating the status and setting the `date_submitted` property) in one database transaction and then separately fetching the application and putting in on a queue to be processed by assess. When we changed this behaviour to update the application and write to the assessment table in one transaction we don't fetch a new application from the database. When the `date_submitted` property is set directly in the code we have been including `timezone.utc` on the `datetime` property. When the application is fetched from the database it does not include (or store) the timezone information - I'm assuming everything by default is in UTC. This means that we changed to serialising the JSON with timezone information (`+00.00`) which caused issues when the assessment code tried to serialise it. This is one method of dealing with that and explicitly instructs marshmallow to serialise the JSON (then stored in the `jsonb_blob` property of assessments) using the format that has been used so far.
There are a lot of steps between configuring that date format we would expect to see and JSON being set in a separate (assess) table. Add a regression test against this changing formats.
5442be2
to
7f908b1
Compare
Quality Gate passedIssues Measures |
date_submitted
is stored both in the application table and in the JSON representation of an application used by the assess tool.Marshmallow will serialise the properties from the application model depending on if there is timezone information included or not. Previously the application store was first "submitting" an application (updating the status and setting the
date_submitted
property) in one database transaction and then separately fetching the application and putting in on a queue to be processed by assess.When we changed this behaviour to update the application and write to the assessment table in one transaction we don't fetch a new application from the database.
When the
date_submitted
property is set directly in the code we have been includingtimezone.utc
on thedatetime
property. When the application is fetched from the database it does not include (or store) the timezone information - I'm assuming everything by default is in UTC.This means that we changed to serialising the JSON with timezone information (
+00.00
) which caused issues when the assessment code tried to serialise it.This is one method of dealing with that and explicitly instructs marshmallow to serialise the JSON (then stored in the
jsonb_blob
property of assessments) using the format that has been used so far.