hatnote / montage

📷 Photo evaluation tool for and by Wiki Loves competitions
https://commons.wikimedia.org/wiki/Commons:Montage
BSD 3-Clause "New" or "Revised" License
36 stars 11 forks source link

When editing votes, GET error is triggered #205

Open lgelauff opened 2 years ago

lgelauff commented 2 years ago

I'm testing on montage-dev.

Reproduce: Create a campaign, create a round (eg with

vote a few images. Then click 'edit my votes'. This triggers a GET error. angular.js:12189 GET https://montage-dev.toolforge.org/v1/juror/round/105/votes?offset=7&order_by=date&sort=desc 403

mahmoud commented 2 years ago

Hey Lodewijk! Great find + report. Note that the montage-dev backend (where this error is coming from) is pretty far ahead of production right now (just waiting for international round to wrap so that I can upgrade safely). I see the 403 and am investigating. If there's a blocker on production, let me know as well!

mahmoud commented 2 years ago

Hmm, having more trouble reproducing this as your user. Just checking at the console (mostly a note to my future self):

>>> session.query(Vote).options(joinedload('round_entry')).filter(Vote.user_id == 409, Vote.round_entry.has(round_id=105), Vote.status == COMPLETED_STATUS).order_by(Vote.modified_date.desc()).limit(15).offset(7).all()
[<Vote id=47479 user_id=409>, <Vote id=47482 user_id=409>, ...]

So no explanation yet. If you visit the URL you mentioned (link) directly, what do you see?

lgelauff commented 2 years ago

I get tables with the information, and no errors.

However, 105 doesn't seem to be an active round? Lets try 112. If I then go to the same direct endpoint, I get 403 forbidden ("no complete ratings") while I made sure to have 4 photos rated.

mahmoud commented 2 years ago

Ah, remove the offset=4 from that URL and it'll likely work. I wonder if the frontend is generating the wrong URL in some cases.

lgelauff commented 2 years ago

Yup, that seems to do the trick