From 61b6b90f77ddf62e4358aa21205e98240cac93a4 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Wed, 23 Sep 2020 13:20:01 -0400 Subject: [PATCH] Fix tests --- src/routes/voteOnSponsorTime.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/routes/voteOnSponsorTime.js b/src/routes/voteOnSponsorTime.js index 8360d63..59a6789 100644 --- a/src/routes/voteOnSponsorTime.js +++ b/src/routes/voteOnSponsorTime.js @@ -169,7 +169,7 @@ function categoryVote(UUID, userID, isVIP, category, hashedIP, res) { // Add the info into the private db if (previousVoteInfo !== undefined) { // Reverse the previous vote - db.prepare('run', "update categoryVotes set votes -= ? where UUID = ? and category = ?", [voteAmount, UUID, previousVoteInfo.category]); + db.prepare('run', "update categoryVotes set votes = votes - ? where UUID = ? and category = ?", [voteAmount, UUID, previousVoteInfo.category]); privateDB.prepare('run', "update categoryVotes set category = ?, timeSubmitted = ?, hashedIP = ? where userID = ?", [category, timeSubmitted, hashedIP, userID]); } else { @@ -191,7 +191,7 @@ function categoryVote(UUID, userID, isVIP, category, hashedIP, res) { if (!currentCategoryInfo && submissionInfo) { db.prepare("run", "insert into categoryVotes (UUID, category, votes) values (?, ?, ?)", [UUID, currentCategory.category, currentCategoryCount]); - privateDB.prepare("run", "insert into categoryVotes (UUID, userID, hashedIP, category, timeSubmitted) values (?, ?, ?, ?, ?)", [UUID, submissionInfo.userID, "unknown", currentCategory.category, submissionUserIDInfo.timeSubmitted]); + privateDB.prepare("run", "insert into categoryVotes (UUID, userID, hashedIP, category, timeSubmitted) values (?, ?, ?, ?, ?)", [UUID, submissionInfo.userID, "unknown", currentCategory.category, submissionInfo.timeSubmitted]); } let nextCategoryCount = (previousVoteInfo.votes || 0) + voteAmount;