mirror of
https://github.com/ajayyy/SponsorBlockServer.git
synced 2025-12-07 20:17:02 +03:00
Merge pull request #119 from ajayyy/experimental
Added decimals to formatted time
This commit is contained in:
@@ -116,7 +116,7 @@ async function voteOnSponsorTime(req, res) {
|
|||||||
return categoryVote(UUID, userID, isVIP, category, hashedIP, res);
|
return categoryVote(UUID, userID, isVIP, category, hashedIP, res);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type == 1 && !isVIP) {
|
if (type == 1 && !isVIP && !isOwnSubmission) {
|
||||||
// Check if upvoting hidden segment
|
// Check if upvoting hidden segment
|
||||||
let voteInfo = db.prepare('get', "SELECT votes FROM sponsorTimes WHERE UUID = ?", [UUID]);
|
let voteInfo = db.prepare('get', "SELECT votes FROM sponsorTimes WHERE UUID = ?", [UUID]);
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,9 @@
|
|||||||
//converts time in seconds to minutes:seconds
|
//converts time in seconds to minutes:seconds
|
||||||
module.exports = function getFormattedTime(seconds) {
|
module.exports = function getFormattedTime(totalSeconds) {
|
||||||
let minutes = Math.floor(seconds / 60);
|
let minutes = Math.floor(totalSeconds / 60);
|
||||||
let secondsDisplay = Math.round(seconds - minutes * 60);
|
let seconds = totalSeconds - minutes * 60;
|
||||||
if (secondsDisplay < 10) {
|
let secondsDisplay = seconds.toFixed(3);
|
||||||
|
if (seconds < 10) {
|
||||||
//add a zero
|
//add a zero
|
||||||
secondsDisplay = "0" + secondsDisplay;
|
secondsDisplay = "0" + secondsDisplay;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user