Fix the winners endpoint resetting the quote votes before comparison
This commit is contained in:
parent
19411a71e4
commit
c339e96578
1 changed files with 6 additions and 5 deletions
|
|
@ -22,11 +22,6 @@ const route: ServerRoute = {
|
|||
// Run through all of the quotes to find the most voted for ones
|
||||
for (var quote of data.quotes) {
|
||||
|
||||
if (finalize) {
|
||||
quote.win_streak++;
|
||||
quote.votes = 0;
|
||||
};
|
||||
|
||||
// New maximum, remove all previous winners
|
||||
if (quote.votes > highest) {
|
||||
winners = [ quote ];
|
||||
|
|
@ -36,6 +31,12 @@ const route: ServerRoute = {
|
|||
else if (quote.votes === highest) {
|
||||
winners.push( quote );
|
||||
};
|
||||
|
||||
// Reset the bracket data as needed
|
||||
if (finalize) {
|
||||
quote.win_streak++;
|
||||
quote.votes = 0;
|
||||
};
|
||||
};
|
||||
|
||||
let count = winners.length;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue