-
Notifications
You must be signed in to change notification settings - Fork 72
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
Fix the removed counts in SIS logging #1184
Conversation
SIS logging incorrectly counted earlier removed students as removed on every updated. Now it counts only those participants who were not removed earlier.
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.
Good. I just think it is best to run the operation and then clear the cache, not the other way around.
for e in qs: | ||
invalidate_content(Enrollment, e) | ||
delcount += 1 | ||
delcount = qs.update(status=Enrollment.ENROLLMENT_STATUS.REMOVED) |
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.
Would it still make more sense to remove the students before invalidating the cache? qs.update()
used to come before invalidate_content()
.
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 tried that first, but it seems that after the update operation the qs becomes empty here. Apparently the update can affect the qs contents if the same attribute that is updated is also used for filtering.
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.
Right, I didn't think of that. At least, one possibility is to copy the original list before running update()
.
qs_before_update = list(qs)
delcount = qs.update(status=...)
for e in qs_before_update:
invalidate_content(...)
Do you prefer to change this or merge the pull request without further changes?
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 don't have strong preference, so either option is fine with me, but is the order between invalidate and update that important? Compared to having a new variable for a temporary list?
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.
It is not a big deal. We can keep it like you originally did.
SIS logging incorrectly counted earlier removed students as removed on every updated. Now it counts only those participants who were not removed earlier.
Description
What?
[ANSWER HERE]
Why?
[ANSWER HERE]
How?
[ANSWER HERE]
Fixes #
Testing
Remember to add or update unit tests for new features and changes.
What type of test did you run?
[ADD A DESCRIPTION ABOUT WHAT YOU TESTED MANUALLY]
Did you test the changes in
Think of what is affected by these changes and could become broken
Translation
Programming style
Have you updated the README or other relevant documentation?
Is it Done?
Clean up your git commit history before submitting the pull request!