-
-
Notifications
You must be signed in to change notification settings - Fork 483
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
Duplicate history cleanup #483
Conversation
Codecov Report
@@ Coverage Diff @@
## master #483 +/- ##
==========================================
+ Coverage 97.23% 97.73% +0.49%
==========================================
Files 16 17 +1
Lines 724 794 +70
Branches 95 110 +15
==========================================
+ Hits 704 776 +72
+ Misses 10 8 -2
Partials 10 10
Continue to review full report at Codecov.
|
@fopina thanks for this! Do you mind trying to hit complete coverage on this PR so that coverage doesn't drop below 97%? Also, if you could add a confirmation prompt in the management command that would also be great. I think @kseever is going to look into using https://github.com/romgar/django-dirtyfields so that duplicates aren't saved in the first place, but this management command will be useful for purging all duplicates. Thanks again! |
I've used dirtyfields before and I guess it should work well. But I don't really mind the duplicate history as long as it is eventually cleaned up, plus, I'm using version 1.9.0 in my apps and Changes to tests are mainly meant to increase coverage, took the opportunity to increase the original |
ec94f4a
to
cf74f32
Compare
Not really sure what to do about that failing check, let me know if something needs to be done :) |
Should I do something else? Looking forward to know whether this is accepted and I upgrade the version of the package in my projects :) |
Could you add some documentation, add your name to AUTHORS.rst and add the change to CHANGES.rst? |
@fopina you still working on this? |
Hope it looks good now :) |
Mind trying to do a bit of refactoring to solve the codeclimate issues? |
I'm afraid I can't @rossmechanic |
61e0072
to
9b7c4b8
Compare
Gave it a try though, 2 down :) |
Thanks for tryin @fopina . Rebasing should get rid of your Radon issues. I would definitely refactor the identical code block into a |
cd0c2aa
to
50ce06a
Compare
There you go! |
50ce06a
to
4df7174
Compare
Looks great! Thanks! |
Management command to find (and remove) duplicate entries in history
Description
Management command to find (and remove) duplicate entries in history
clean_duplicate_history
Related Issue
fixes #313
Motivation and Context
As discussed in #313 there are cases where we just
.save()
without checking if anything actually changed (as we didn't have the original data loaded).For the same reason, doing that check in
simple_history
would have a big performance impact (force a SELECT before any UPDATE) for something that is not required by everyone (as I also prefer performance over clean history).But we can have both (performance and clean history) if we clean up the history "later" hence I made a management command like this one over an year ago and been using it in quite a few apps so far.
Now I finally decided to rewrite it according to the code style of this project and share it :)
How Has This Been Tested?
Unit test made (and included) and manual testing using a test app (basically doing the same scripted in the unit test)
Screenshots (if appropriate):
Types of changes
Checklist:
make format
command to format my code