Update src/routes/voteOnSponsorTime.js

Co-authored-by: Ajay Ramachandran <dev@ajay.app>
This commit is contained in:
Joe Dowd 2020-08-22 20:45:31 +01:00 committed by GitHub
parent 16c68dd51d
commit fba25fea0f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -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);
},
};
};