Fix: reset puzzle streak correctly when failing the first puzzle#2452
Fix: reset puzzle streak correctly when failing the first puzzle#2452veloce merged 6 commits intolichess-org:mainfrom
Conversation
veloce
left a comment
There was a problem hiding this comment.
I'm not sure to understand why there was a regression, and the fix. Could you explain more? thank.
@veloce It seems that if you fail a puzzle streak very soon after starting, the lichess API will send back the exact same puzzle streak. This behavior is reproducible on https://lichess.org/streak When you fail on the first puzzle of the streak, and the server sends back the exact same streak, it causes the previous fix for this issue not to work, because the puzzle you failed on is the same as the one it's trying to load. My fix replaces the |
#1951 had a previous fix but issue has returned.
Previous fix checked if the puzzle id is the same or has changed, but there seems to be a separate issue where the same puzzle streak re-plays sometimes if you fail early. I logged that as a separate issue at #2455
I replaced the puzzle id check with a check for if the value of
finishedis going from true to false. Also wrote a unit test to prevent further regression