-
Notifications
You must be signed in to change notification settings - Fork 18
fix: Skip button reloading from cached images #360
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
base: master
Are you sure you want to change the base?
Conversation
mahmoud
left a comment
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.
Interesting! I believe skip worked before the new frontend. I half expected this to be primarily frontend code changes, but I see it's only backend changes. Are there supposed to be frontend changes too?
Also, when updating the backend we should probably be adding tests for repro/regression protection, as well.
montage/juror_endpoints.py
Outdated
| result = juror_dao.skip_voting(vote_id, round_id) | ||
|
|
||
| if isinstance(result, InvalidAction): | ||
| return {'error': str(result)}, 400 |
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.
Doesn't raising InvalidAction do a 400 already?
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.
Yes, I was just using that to test something else, while I was working on this. I'll remove it soon.
| ) | ||
|
|
||
| round_juror = self._get_round_juror(round_id) | ||
| skip = round_juror.skip |
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.
So this was raising eh? Surprised I didn't see it on Sentry.
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.
Yes, this was the root cause! The code was trying to read round_juror.skip (which doesn't exist) instead of round_juror.flags['skip']. It didn't crash because it just returned None, so the skip filter was silently never applied. This caused skipped images to keep reappearing.
montage/rdb.py
Outdated
| flag_modified(round_juror, 'flags') | ||
|
|
||
| self.rdb_session.add(round_juror) | ||
| self.rdb_session.commit() |
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 believe commit should be handled by the middleware
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.
Sry about that, I'll remove that line
YES, the frontend changes are absolutely required. For some reason that I checked now, the changes I made on |
|
I've also attached the recording of this fix on the issue. Here |
Description
Fixes #319
This PR fixes the problem with the skip button which does not loads from the backend but instead endlessly loop over the same 10 images which was cached until we accept/reject any image in that set.
The root cause was just a mismatch on the backend, since it was supposed to call
round_juror.flags['skip']but it was trying to read fromround_juror.skipcolumn which does not exist.Moreover the frontend didn't even had a POST method to convey the backend about the skip, due to which the backend never knew about the skip.