mirror of
https://github.com/monkeytypegame/monkeytype.git
synced 2025-11-08 13:11:19 +08:00
fixed quote ratings resetting after submitting a rating
This commit is contained in:
parent
cd77779475
commit
b52d58e9f8
1 changed files with 11 additions and 6 deletions
|
|
@ -162,12 +162,17 @@ async function submit() {
|
|||
if (quoteRatings[currentQuote.language][currentQuote.id] == undefined)
|
||||
quoteRatings[currentQuote.language][currentQuote.id] = undefined;
|
||||
quoteRatings[currentQuote.language][currentQuote.id] = rating;
|
||||
quoteStats = {
|
||||
ratings: 1,
|
||||
totalRating: parseInt(rating),
|
||||
quoteId: currentQuote.id,
|
||||
language: currentQuote.language,
|
||||
};
|
||||
if (quoteStats) {
|
||||
quoteStats.ratings++;
|
||||
quoteStats.totalRating += parseInt(rating);
|
||||
} else {
|
||||
quoteStats = {
|
||||
ratings: 1,
|
||||
totalRating: parseInt(rating),
|
||||
quoteId: currentQuote.id,
|
||||
language: currentQuote.language,
|
||||
};
|
||||
}
|
||||
Notifications.add("Rating submitted", 1);
|
||||
}
|
||||
quoteStats.average = (
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue