-
Notifications
You must be signed in to change notification settings - Fork 172
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
feat: skip the history object creation #4071
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,13 +30,16 @@ def _assert_normal_case_pre_command(self): | |
""" | ||
Verify the history count before running the clean-up command. | ||
""" | ||
# Induce a few history records: | ||
# - 2 updates for courserun1 | ||
# - 0 updates for courserun2 | ||
# - 3 updates for courserun3 | ||
self.courserun1.title = 'test title' | ||
self.courserun1.save() | ||
|
||
self.courserun3.title = 'test title' | ||
self.courserun3.save() | ||
|
||
self.courserun1.title = 'test title again' | ||
self.courserun1.save() | ||
|
||
self.courserun3.title = 'test title again' | ||
self.courserun3.save() | ||
factories.CourseRunFactory() # Toss in a fourth create to mix things up. | ||
self.courserun3.save() | ||
|
@@ -48,9 +51,9 @@ def _assert_normal_case_pre_command(self): | |
# Ensure that there are multiple history records for each course run. For each | ||
# course run, there should be 2 (baseline) + the amount we added at the | ||
# beginning of this test * 2 for the double save for enterprise inclusion boolean | ||
assert courserun1_count_initial == ((2 + 2) * 2) | ||
assert courserun2_count_initial == ((2 + 0) * 2) | ||
assert courserun3_count_initial == ((2 + 3) * 2) | ||
assert courserun1_count_initial == 3 | ||
assert courserun2_count_initial == 1 | ||
assert courserun3_count_initial == 3 | ||
|
||
def _assert_normal_case_post_command(self): | ||
""" | ||
|
@@ -61,9 +64,10 @@ def _assert_normal_case_post_command(self): | |
courserun3_count_final = CourseRun.history.filter(id=self.courserun3.id).count() # pylint: disable=no-member | ||
|
||
# Ensure that the only history records left are the 3 original creates. | ||
assert courserun1_count_final == 1 | ||
# count remains same because all history instances are unique. | ||
assert courserun1_count_final == 3 | ||
assert courserun2_count_final == 1 | ||
assert courserun3_count_final == 1 | ||
assert courserun3_count_final == 3 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please ensure that inline comments are updated to reflect the changes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. yes, a comment was added just above the assert statement(s). |
||
|
||
def test_normal_case(self): | ||
""" | ||
|
This file was deleted.
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.
Can this increase loading time on admin? There are million of rows on prod, just be careful here.
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.
I have to add this change because of the difference in working nature of django model admin and simple history admin. Changes in this PR can better be observed via
SimpleHistoryAdmin
.Your concern is valid.After its deployment, i ll monitor it and will take any followup action accordingly.