codewars / codewars.com

Issue tracker for Codewars
https://www.codewars.com
BSD 2-Clause "Simplified" License
2.09k stars 219 forks source link

Kata voting is not always guaranteed that vote of one account is counted not more than once #1660

Open ZEDCWT opened 5 years ago

ZEDCWT commented 5 years ago

Describe the bug

This kata is only completed by one user (me) but has 2 'Somewhat Satisfied' votes

To Reproduce

So i just finished it at about 12.29 12:10+0800 and tried to gave a 'Somewhat Satisfied' vote But accidentally clicked on 'Very' just after clicking 'Somewhat' button before it responsed After it got responsed, i refereshed the page and seeing Pony Where the counter shows 75% of 2 instead of xx% of 1 And if i switch to 'Somewhat' vote Ponx I thought it was just accidentally count the vote twice so i toggled off the vote and got Ponw When i re-vote again, it still reports 2 votes

To clearify, im the only one completed that kata and there were no votes before i voted (apparently) ponv

In conclusion, a phantom vote is created by such operations.

┆Issue is synchronized with this Clickup by Unito

kazk commented 5 years ago

I think I've seen this happen before. Kata voting has some black magic that I don't fully understand yet.

I've fixed the data for this one for now. I'll look into the cause.

The main problem is that the actual votes are stored separately and it should update the value on kata when changed, but sometimes it fails to for various reasons.

jhoffner commented 5 years ago

The screenshots shown show 2 completions (the circles icon). Total Code Submissions may only say 1 because the author's doesn't count.

Authors shouldn't be able to vote on their own kata, thats a bug (or at least a design flaw)

kazk commented 5 years ago

The vote wasn't by the author. The only user with vote was @ZEDCWT and his vote was counted twice. It was "stuck" due to race condition (second vote was added while the first one was still being processed). I think this is what happened because I was able to fix the data by simply making it recalculate.