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

Keep user data #37

Merged
merged 11 commits into from
Sep 18, 2024
Merged

Keep user data #37

merged 11 commits into from
Sep 18, 2024

Conversation

glass-ships
Copy link
Member

Short description of the changes:

This PR serves to modify the previously added code to preserve user-associated plots while only purging beamline data.

Long description of the changes:

  • Allow expiration_date to be blank/null at first
  • Move the value assignment for expiration_date into datarun.clean(), allowing the value to be set relative to creation date
  • modify migration in a similar way (also merge id data field migration into initial)

Check list for the pull request

  • I have read the [CONTRIBUTING]
  • I have read the [CODE_OF_CONDUCT]
  • I have added tests for my changes
  • I have updated the documentation accordingly

Check list for the reviewer

  • I have read the [CONTRIBUTING]
  • I have verified the proposed changes
  • best software practices
    • all internal functions have an underbar, as is python standard
    • clearly named variables (better to be verbose in variable names)
    • code comments explaining the intent of code blocks
  • All the tests are passing
  • The documentation is up to date
  • code comments added when explaining intent

Manual test for the reviewer

References

Copy link

codecov bot commented Sep 17, 2024

Codecov Report

Attention: Patch coverage is 89.13043% with 5 lines in your changes missing coverage. Please review.

Project coverage is 89.85%. Comparing base (749e772) to head (05f1dd5).
Report is 14 commits behind head on next.

Files with missing lines Patch % Lines
src/apps/plots/models.py 42.85% 4 Missing ⚠️
src/config/instruments.py 97.43% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             next      #37      +/-   ##
==========================================
- Coverage   90.00%   89.85%   -0.15%     
==========================================
  Files          10       11       +1     
  Lines         310      355      +45     
==========================================
+ Hits          279      319      +40     
- Misses         31       36       +5     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Collaborator

@backmari backmari left a comment

Choose a reason for hiding this comment

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

Good catch to not delete user data. The plots created in the unit tests are created correctly with the user data having an expiration date in 2100 and the instrument data three years into the future. Looks good to me 👌

livedatadb=# select * from plots_datarun;
 id | run_number |      run_id       |          created_on           | instrument_id |        expiration_date        
----+------------+-------------------+-------------------------------+---------------+-------------------------------
  5 |      12345 |                   | 2024-09-18 16:32:19.854356+00 |             5 | 2027-09-18 16:32:19.84804+00
  6 |          6 | reflectivity.json | 2024-09-18 16:32:20.024337+00 |             6 | 2100-01-01 00:00:00+00
  7 |      12346 |                   | 2024-09-18 16:32:20.51581+00  |             7 | 2027-09-18 16:32:20.512165+00
  8 |        123 |                   | 2024-09-18 16:32:20.862616+00 |             8 | 2027-09-18 16:32:20.858818+00
(4 rows)

@glass-ships glass-ships merged commit dcfe5f0 into next Sep 18, 2024
4 checks passed
@glass-ships glass-ships deleted the keep-user branch September 18, 2024 17:15
@glass-ships glass-ships mentioned this pull request Sep 18, 2024
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.

2 participants