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

Reimplement timestamp logic #5123

Merged
merged 2 commits into from
Jul 22, 2024
Merged

Reimplement timestamp logic #5123

merged 2 commits into from
Jul 22, 2024

Conversation

realVinayak
Copy link
Contributor

@realVinayak realVinayak commented Jul 22, 2024

Fixes #5108

Checklist

  • Self-review the PR after opening it to make sure the changes look good
    and self-explanatory (or properly documented)
  • Add automated tests
  • Add relevant issue to release milestone

Testing instructions

@realVinayak realVinayak requested review from acwhite211 and a team July 22, 2024 18:10
@grantfitzsimmons
Copy link
Member

This must be tested:

image


Expected Behavior:

  • When a column within a specified table is linked to either timestampModified or timestampCreated, it should not be automatically replaced upon uploading new data.
  • In cases where a column is not associated with timestampModified or timestampCreated, the system should autonomously allocate both fields with the current timestamp.
  • When new records are generated in other tables during the same upload process, if no column is directly linked to timestampModified or timestampCreated, the system should automatically assign both fields with the current timestamp.
  • timestampModified or timestampCreated should be assigned the current timestamp in all cases during WorkBench uploads except when a column is mapped to that field where that row contains a value

@realVinayak
Copy link
Contributor Author

we also don't need

django-model-utils==4.4.0
anymore, @acwhite211

@realVinayak realVinayak linked an issue Jul 22, 2024 that may be closed by this pull request
Copy link
Collaborator

@emenslin emenslin left a comment

Choose a reason for hiding this comment

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

Expected Behavior:

  • When a column within a specified table is linked to either timestampModified or timestampCreated, it should not be automatically replaced upon uploading new data.
  • In cases where a column is not associated with timestampModified or timestampCreated, the system should autonomously allocate both fields with the current timestamp.
  • When new records are generated in other tables during the same upload process, if no column is directly linked to timestampModified or timestampCreated, the system should automatically assign both fields with the current timestamp.
  • timestampModified or timestampCreated should be assigned the current timestamp in all cases during WorkBench uploads except when a column is mapped to that field where that row contains a valu

I worked mostly with the CO table and the Agents table and everything looks good. All cases mentioned in the expected behavior work and the timestamp modified field is now updated when a record is edited.

@emenslin emenslin requested a review from a team July 22, 2024 18:35
@acwhite211
Copy link
Member

we also don't need

django-model-utils==4.4.0

anymore

Ya, since we're not using the FieldTracker anymore for tracking changes in the timestamp fields, we can remove this requirement.

Copy link
Contributor

@alesan99 alesan99 left a comment

Choose a reason for hiding this comment

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

  • When a column within a specified table is linked to either timestampModified or timestampCreated, it should not be automatically replaced upon uploading new data.
  • In cases where a column is not associated with timestampModified or timestampCreated, the system should autonomously allocate both fields with the current timestamp.
  • When new records are generated in other tables during the same upload process, if no column is directly linked to timestampModified or timestampCreated, the system should automatically assign both fields with the current timestamp.
  • timestampModified or timestampCreated should be assigned the current timestamp in all cases during WorkBench uploads except when a column is mapped to that field where that row contains a valu

I can confirm timestamps are being updated again for collection objects 👍 I uploaded the same data I did when comparing to edge.
The timestamps are also filled in accordingly when there is no corresponding columns.

@Areyes42 Areyes42 self-requested a review July 22, 2024 18:55
Copy link
Contributor

@Areyes42 Areyes42 left a comment

Choose a reason for hiding this comment

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

  • When a column within a specified table is linked to either timestampModified or timestampCreated, it should not be automatically replaced upon uploading new data.
  • In cases where a column is not associated with timestampModified or timestampCreated, the system should autonomously allocate both fields with the current timestamp.
  • When new records are generated in other tables during the same upload process, if no column is directly linked to timestampModified or timestampCreated, the system should automatically assign both fields with the current timestamp.
  • timestampModified or timestampCreated should be assigned the current timestamp in all cases during WorkBench uploads except when a column is mapped to that field where that row contains a value

I tested on COs, agent, and locality tables, and it looks like all the timestamps are now properly updated compared to the behavior in edge 👌

Copy link
Collaborator

@lexiclevenger lexiclevenger left a comment

Choose a reason for hiding this comment

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

Expected Behavior:

  • When a column within a specified table is linked to either timestampModified or timestampCreated, it should not be automatically replaced upon uploading new data.
  • In cases where a column is not associated with timestampModified or timestampCreated, the system should autonomously allocate both fields with the current timestamp.
  • When new records are generated in other tables during the same upload process, if no column is directly linked to timestampModified or timestampCreated, the system should automatically assign both fields with the current timestamp.
  • timestampModified or timestampCreated should be assigned the current timestamp in all cases during WorkBench uploads except when a column is mapped to that field where that row contains a value

Looks good! Timestampmodified is also updated again when a record is modified through the data entry form.

Copy link
Contributor

@melton-jason melton-jason left a comment

Choose a reason for hiding this comment

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

Looks solid!

specifyweb/specify/model_timestamp.py Show resolved Hide resolved
@realVinayak realVinayak merged commit 08dc104 into 7962-hotfix Jul 22, 2024
9 checks passed
@realVinayak realVinayak deleted the issue-5108 branch July 22, 2024 21:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

TimestampModified not being updated when modifying records
9 participants