Skip to content
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

2119 created updated #2149

Merged
merged 11 commits into from
Mar 25, 2020
Merged

2119 created updated #2149

merged 11 commits into from
Mar 25, 2020

Conversation

adrian-lara
Copy link
Contributor

@adrian-lara adrian-lara commented Mar 20, 2020

---------This PR contains a migration---------

Any background context you want to provide?

See #2118 for the 2.6.1 release version of this fix - that was more of a hot-fix.

This is presumably a more thorough fix.

From that PR:

Within SEED, users were presented with created and updated datetime stamps for property and tax lot records.

During the matching revamp work, it was discovered that the datetime stamp was actually coming from the canonical Property and canonical Tax Lot respectively. Ideally, these would be coming from the respective -States models since that is what actually holds the record information that users are seeing. Since linking was not in place, canonical records and connected -State records were 1-to-1, and it wasn't actually an issue.
...

What's this PR do?

This PR shifts users away from created and updated values coming from the canonical objects and uses the values coming from the -State objects, with the main focus being on what's provided in the inventory list and detail pages.

Also, on the inventory detail page, all the historical created and updated values are provided as well.

How should this be manually tested?

Import, merge, update, etc. records and sanity-check created and updated times on inventory list and detail pages.

On a production database, cross-check unedited, unmerged records' created and updated times with the corresponding file import time. I've spot checked this myself, but more checks from others couldn't hurt. (see Further considerations)

As far as code review, there aren't many code changes, but commits can be used to help distinguish the "reason" behind changes.

Further considerations

  • I was expecting to have to backfill the created and updated -State values with -related audit logs, but that didn't seem to be the case. The -State records seem to have created values that would indicate they are the actual created times when looking at corresponding import file dates - the hour might be off but I think that might be caused by timezone differences. Anyone know why the -State records looks to have valid values already? The migrations filling in these values can be found in 0111_rehash.py.

  • Initial record edits trigger the creation of a new -State. As far as I know, users aren't relying on the created time for bulk downstream processes. For non-bulk created times analysis, since historical records now have these values, created times can be read off the "oldest" version of the record. (See screenshot below). I don't think needs to be changed but is worth noting.

What are the relevant tickets?

#2119

Screenshots (if appropriate)

Screen Shot 2020-03-20 at 12 41 34 PM

@coveralls
Copy link

coveralls commented Mar 20, 2020

Coverage Status

Coverage increased (+0.08%) to 77.562% when pulling 746c83d on 2119_created_updated into 8258602 on develop.

def forwards(apps, schema_editor):
property_sql = (
'UPDATE seed_propertystate '
'SET updated = (SELECT created '
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This and the tax lot version of this change looks good - thanks for making it Alex!

@axelstudios axelstudios self-requested a review March 25, 2020 21:52
Copy link
Member

@axelstudios axelstudios left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Tested, looks good to me

@axelstudios axelstudios merged commit eb9a7cc into develop Mar 25, 2020
@axelstudios axelstudios deleted the 2119_created_updated branch March 25, 2020 22:28
adrian-lara pushed a commit that referenced this pull request Mar 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants