From ad169fd6e7cd4cebff0d0dff7fbd424ba2d4d0ff Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Wed, 29 Apr 2020 21:30:07 -0400 Subject: [PATCH] Added VIP support to category vote --- src/routes/voteOnSponsorTime.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/routes/voteOnSponsorTime.js b/src/routes/voteOnSponsorTime.js index 992512a..c7c1e63 100644 --- a/src/routes/voteOnSponsorTime.js +++ b/src/routes/voteOnSponsorTime.js @@ -23,6 +23,8 @@ function categoryVote(UUID, userID, isVIP, category, hashedIP, res) { let timeSubmitted = Date.now(); + let voteAmount = isVIP ? 500 : 1; + // Add the vote if (db.prepare("select count(*) as count from categoryVotes where UUID = ? and category = ?").get(UUID, category).count > 0) { // Update the already existing db entry @@ -52,7 +54,8 @@ function categoryVote(UUID, userID, isVIP, category, hashedIP, res) { let nextCategoryCount = (previousVoteInfo.votes || 0) + 1; //TODO: In the future, raise this number from zero to make it harder to change categories - if (nextCategoryCount - currentCategoryCount >= 0) { + // VIPs change it every time + if (nextCategoryCount - currentCategoryCount >= 0 || isVIP) { // Replace the category db.prepare("update sponsorTimes set category = ? where UUID = ?").run(category, UUID); }