-
Notifications
You must be signed in to change notification settings - Fork 330
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
Soft delete assets from deleted facilities/hospitals #1996
Conversation
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.
No changes to the fields in the model were made. But why are there migrations for it?
@rithviknishad I was initially using models.cascade but later I realised I need to perform soft delete so I changed it back to original ones so that's why you can see those redundant migrations.But the functionality is working. Should I remove those redundant migrations? |
@rithviknishad I made a second commit i removed those redundant migration history so effectively i just added the delete method in facility model |
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.
Custom migration needed to delete existing such assets of deleted facility.
https://docs.djangoproject.com/en/5.0/ref/migration-operations/#runpython
Also test cases needs to be added. It'd be great if you could follow the PR template 😄 |
@rithviknishad ya sure I'll make the changes by today |
@rithviknishad I added custom migrations and also added api test case but the tests are not running in my machine because im using windows and im probably getting some connection errors with the test db like some dbus connection errors and no such bucket found. It is giving a failed test for medibase api maybe some db connection issues in windows |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## develop #1996 +/- ##
===========================================
+ Coverage 65.38% 65.41% +0.02%
===========================================
Files 242 242
Lines 13976 13988 +12
Branches 1937 1938 +1
===========================================
+ Hits 9138 9150 +12
Misses 4455 4455
Partials 383 383 ☔ View full report in Codecov by Sentry. |
@sainak plz review the commit... |
@sainak @rithviknishad i added the cron job and should i remove the tests also for soft delete that i created because now that wont work right and maybe the custom migration is also not needed because every midnight the assets will be soft deleted and should i add logging infos and warnings in the task function? plz review it and tell me if any changes required |
@hrit2773 You can remove the custom migration since it'd be taken care by the celery task itself right. |
@rithviknishad yes I'll remove it and I'll remove the api test case also because I feel that is not needed |
@sainak view the changes.. and also replaced external_id with id |
@sainak can you review the changes |
@rithviknishad @sainak lets close this issue today |
@sainak @vigneshhari can you review this PR |
Why is this a background job? cant we just soft delete assets if the facility is archived? we cant add assets to a deleted facility right? @sainak |
@vigneshhari I did that initially but @sainak asked me to run an cron job |
Fixes #1982 issue, enabled soft delete of assets by overriding delete method in facility model