From fba25fea0fe68d9db7ec8715fbe3c51866fd2e5d Mon Sep 17 00:00:00 2001 From: Joe Dowd Date: Sat, 22 Aug 2020 20:45:31 +0100 Subject: [PATCH] Update src/routes/voteOnSponsorTime.js Co-authored-by: Ajay Ramachandran --- 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 1e55ed9..3841390 100644 --- a/src/routes/voteOnSponsorTime.js +++ b/src/routes/voteOnSponsorTime.js @@ -98,7 +98,7 @@ async function voteOnSponsorTime(req, res) { let isVIP = db.prepare('get', "SELECT count(*) as userCount FROM vipUsers WHERE userID = ?", [nonAnonUserID]).userCount > 0; //check if user voting on own submission - let isOwnSubmission = !!db.prepare('all', 'SELECT UUID as submissionCount FROM sponsorTimes where userID = ? AND UUID = ?', [nonAnonUserID, UUID]).length; + let isOwnSubmission = db.prepare("get", "SELECT UUID as submissionCount FROM sponsorTimes where userID = ? AND UUID = ?", [nonAnonUserID, UUID]) !== undefined; if (type === undefined && category !== undefined) { return categoryVote(UUID, userID, isVIP, category, hashedIP, res); @@ -314,4 +314,4 @@ module.exports = { endpoint: function (req, res) { voteOnSponsorTime(req, res); }, - }; \ No newline at end of file + };