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

Autodeletion #2923

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft

Autodeletion #2923

wants to merge 6 commits into from

Conversation

elimbaum
Copy link
Contributor

@elimbaum elimbaum commented Apr 13, 2023

I rule and have completed some work on Case Manager that's ready for review!

(brief, plain english overview of your changes here)

This pull request makes the following changes:

  • creates autodeletion system
  • uses Timecop for testing
  • TODO: test nightly task?

(If there are changes to the views, please include a screenshot so we know what to look for!)

It relates to the following issue #s:

For reviewer:

  • Adjust the title to explain what it does for the notification email to the listserv.
  • Tag this PR:
    • feature if it contains a feature, fix, or similar. This is anything that contains a user-facing fix in some way, such as frontend changes, alterations to backend behavior, or bug fixes.
    • dependencies if it contains library upgrades or similar. This is anything that upgrades any dependency, such as a Gemfile update or npm package upgrade.
  • If it contains neither, no need to tag this PR.

Comment on lines +18 to +20
def self.included(base)
base.extend(ClassMethods)
end
Copy link
Contributor Author

Choose a reason for hiding this comment

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

if this is to gnarly i can make a change ;)

Comment on lines +92 to +108
c.save!
end

it 'deletes pt_a on the right day' do
Timecop.freeze(1.day.ago) do
Patient.autodelete!
assert_includes Patient.all, @pt_a
end

# present day - doesn't delete because <, not <=
Patient.autodelete!
assert_includes Patient.all, @pt_a

Timecop.freeze(1.day.after) do
Patient.autodelete!
refute_includes Patient.all, @pt_a
end
Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok this is a lil weird, because i'm using < with today, so it does a date-, not time-based comparison. I don't particularly have an issue with this -- I don't think funds will care exactly which day a patient deletes. but let me know and I can make it a bit more intuitive.

@elimbaum
Copy link
Contributor Author

While this draft works, given our discussions yesterday, I think we should take a bit of time to consider exactly what we want this PR to do (and not do)

@elimbaum elimbaum requested a review from lomky May 7, 2023 18:33
@elimbaum
Copy link
Contributor Author

elimbaum commented May 7, 2023

@lomky let me know what you think of this — and particularly what other kinds of tests would help! have some time to work on things this week

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.

Create a configurable, automatic data deletion cleanup process
1 participant