Skip to content

Conversation

@ItsAbhinavM
Copy link
Contributor

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 from round_juror.skip column 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.

Copy link
Member

@mahmoud mahmoud left a 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.

result = juror_dao.skip_voting(vote_id, round_id)

if isinstance(result, InvalidAction):
return {'error': str(result)}, 400
Copy link
Member

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?

Copy link
Contributor Author

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
Copy link
Member

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.

Copy link
Contributor Author

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()
Copy link
Member

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

Copy link
Contributor Author

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

@ItsAbhinavM
Copy link
Contributor Author

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.

YES, the frontend changes are absolutely required. For some reason that I checked now, the changes I made on vote/ directory was not even staged for this PR. I added a seperate call for this skiptask since this was the one who called the whole issue. I added it on both VoteRating.vue and VoteYesNo.vue. I'll be adding these along with the changes you have requested. Now everything should go as planned for this bugfix :)

@ItsAbhinavM ItsAbhinavM requested a review from mahmoud December 31, 2025 08:55
@ItsAbhinavM
Copy link
Contributor Author

I've also attached the recording of this fix on the issue. Here

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Skip button does not work as expected

2 participants