From 2f2273b8a8bf0c875a9b910d1e5a436872c01362 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Mon, 24 Aug 2020 20:12:57 -0400 Subject: [PATCH 1/3] Added decimals to formatted time --- src/utils/getFormattedTime.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/utils/getFormattedTime.js b/src/utils/getFormattedTime.js index 6f3ef40..37d22b6 100644 --- a/src/utils/getFormattedTime.js +++ b/src/utils/getFormattedTime.js @@ -1,8 +1,9 @@ //converts time in seconds to minutes:seconds module.exports = function getFormattedTime(seconds) { let minutes = Math.floor(seconds / 60); - let secondsDisplay = Math.round(seconds - minutes * 60); - if (secondsDisplay < 10) { + let seconds = seconds - minutes * 60; + let secondsDisplay = seconds.toFixed(3); + if (seconds < 10) { //add a zero secondsDisplay = "0" + secondsDisplay; } From f4b36867ffbb6a1fb627b26f39388d90e65bb534 Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Mon, 24 Aug 2020 20:15:46 -0400 Subject: [PATCH 2/3] Fixed duplicate variable --- src/utils/getFormattedTime.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils/getFormattedTime.js b/src/utils/getFormattedTime.js index 37d22b6..0d86271 100644 --- a/src/utils/getFormattedTime.js +++ b/src/utils/getFormattedTime.js @@ -1,7 +1,7 @@ //converts time in seconds to minutes:seconds -module.exports = function getFormattedTime(seconds) { - let minutes = Math.floor(seconds / 60); - let seconds = seconds - minutes * 60; +module.exports = function getFormattedTime(totalSeconds) { + let minutes = Math.floor(totalSeconds / 60); + let seconds = totalSeconds - minutes * 60; let secondsDisplay = seconds.toFixed(3); if (seconds < 10) { //add a zero From f7bde024cb88a3201dc230a28e94b445fd55176c Mon Sep 17 00:00:00 2001 From: Ajay Ramachandran Date: Mon, 24 Aug 2020 20:21:39 -0400 Subject: [PATCH 3/3] Allow self-upvotes on dead submissions --- src/routes/voteOnSponsorTime.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/routes/voteOnSponsorTime.js b/src/routes/voteOnSponsorTime.js index f2cf152..abe9262 100644 --- a/src/routes/voteOnSponsorTime.js +++ b/src/routes/voteOnSponsorTime.js @@ -116,7 +116,7 @@ async function voteOnSponsorTime(req, res) { return categoryVote(UUID, userID, isVIP, category, hashedIP, res); } - if (type == 1 && !isVIP) { + if (type == 1 && !isVIP && !isOwnSubmission) { // Check if upvoting hidden segment let voteInfo = db.prepare('get', "SELECT votes FROM sponsorTimes WHERE UUID = ?", [UUID]);