-
Notifications
You must be signed in to change notification settings - Fork 1
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
Add significantly_updated_at
attribute to User
#1991
Conversation
81c3632
to
b225009
Compare
Review app deployed to https://npq-registration-review-1991-web.test.teacherservices.cloud/ |
e362d21
to
dddd259
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.
It's looking good tks.. 👍 I reckon we can backfill significantly_updated_at
to be the same as updated_at
for the other records as part of the ticket as well?
dddd259
to
9e7bb5f
Compare
@@ -58,12 +58,12 @@ def call | |||
active_alert: npq_application.active_alert || user.active_alert, | |||
trn_verified:, | |||
created_at: ecf_user.created_at, | |||
updated_at: ecf_user.updated_at, | |||
significantly_updated_at: ecf_user.updated_at, |
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.
Maybe we still can keep migrating updated_at
over or not?
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.
discussed in person: let's keep both
We have an `updated_at` on the `User` model, however this is updated frequently and for actions that lead providers don't need to care about (such as when a user signs in). We want to add a second `updarted_at` attribute that only updates when something significant changes with the `User`, such as their name, TRN, etc. As the `Application` can touch a `User` we also need this attribute to update when the user is touched. I opted for `significantly_updated_at` as the attribute name as opposed to `api_updated_at` to try and keep it more generic in case we want to surface it elsewhere. Index the field to ensure endpoints that filter by `updated_at` will be performant when we switch them to `significantly_updated_at`.
We want to populate `significantly_udpated_at` instead of `updated_at` as we will be exposing this attribute in the serializers for the lead provider API.
We want to filter by the `significantly_updated_at` attribute instead of the `updated_at` attribute when querying users for the lead provider API. This will prevent insignificant changes to a `User` resulting in them being re-surfaced in the API. Update `Participants::Query` and `Applications::Query` to use `significantly_updated_at`.
We want to surface the `sigificant_updated_at` attribute of participants in the lead provider API responses so that providers only see changes/updates when something they care about has changed with the user.
Exclude `significantly_updated_at` from these feature specs.
We want to retain updating `updated_at` on users as well as populating the new `significantly_updated_at` during the migration.
We want to ensure we don't touch `significantly_updated_at` from the callback in `User` when performing a migration.
We want to backfill the `significantly_updated_at` using the `updated_at` attribute of each user.
a51f25b
to
8abfaf7
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.
All good 👍 tks @ethax-ross 😄
Jira-3747
Context
At the moment, we use the
User#updated_at
to surface changes to lead providers via the API. The issue with this is that actions/changes that lead providers don't care about result in the user being marked as 'updated'. Instead, we want to have an additionalupdated_at
attribute that we can use to surface the changes lead providers care about to the underlyingUser
model.Changes proposed in this pull request
We have an
updated_at
on theUser
model, however this is updated frequently and for actions that lead providers don't need to care about (such as when a user signs in).We want to add a second
updarted_at
attribute that only updates when something significant changes with theUser
, such as their name, TRN, etc.As the
Application
can touch aUser
we also need this attribute to update when the user is touched.I opted for
significantly_updated_at
as the attribute name as opposed toapi_updated_at
to try and keep it more generic in case we want to surface it elsewhere.Index the field to ensure endpoints that filter by
updated_at
will be performant when we switch them to significantly_updated_at`.We want to populate
significantly_udpated_at
instead ofupdated_at
as we will be exposing this attribute in the serializers for the lead provider API.We want to filter by the
significantly_updated_at
attribute instead of theupdated_at
attribute when querying users for the lead provider API. This will prevent insignificant changes to aUser
resulting in them being re-surfaced in the API.We want to surface the
sigificant_updated_at
attribute of participants in the lead provider API responses so that providers only see changes/updates when something they care about has changed with the user.Guidance to review
As it stands any users already in the NPQ reg database that aren't touched as part of the migration will end up with a default
significantly_updated_at
time of 'now' (when we roll this out). Do we want to backfill to match with the userupdated_at
for these records?