Removed null coalescence operator

This commit is contained in:
Ajay Ramachandran
2020-05-16 00:15:33 -04:00
parent dc7cd0993a
commit 7f07794ce4

View File

@@ -266,14 +266,15 @@ module.exports = async function voteOnSponsorTime(req, res) {
//for each positive vote, see if a hidden submission can be shown again //for each positive vote, see if a hidden submission can be shown again
if (incrementAmount > 0 && voteTypeEnum === voteTypes.normal) { if (incrementAmount > 0 && voteTypeEnum === voteTypes.normal) {
//find the UUID that submitted the submission that was voted on //find the UUID that submitted the submission that was voted on
let submissionUserID = db.prepare("SELECT userID FROM sponsorTimes WHERE UUID = ?").get(UUID)?.userID; let submissionUserIDInfo = db.prepare("SELECT userID FROM sponsorTimes WHERE UUID = ?").get(UUID).userID;
if (!submissionUserIDInfo) {
if (!submissionUserID) {
// They are voting on a non-existent submission // They are voting on a non-existent submission
res.status("Voting on a non-existent submission").send(400); res.status("Voting on a non-existent submission").send(400);
return; return;
} }
let submissionUserID = submissionUserIDInfo.userID;
//check if any submissions are hidden //check if any submissions are hidden
let hiddenSubmissionsRow = db.prepare("SELECT count(*) as hiddenSubmissions FROM sponsorTimes WHERE userID = ? AND shadowHidden > 0").get(submissionUserID); let hiddenSubmissionsRow = db.prepare("SELECT count(*) as hiddenSubmissions FROM sponsorTimes WHERE userID = ? AND shadowHidden > 0").get(submissionUserID);