diff --git a/index.html b/index.html index 7d52a9d..aa40689 100644 --- a/index.html +++ b/index.html @@ -3,7 +3,6 @@ Meeting Roulette - @@ -19,6 +18,7 @@ type="text/css" /> + @@ -41,7 +41,7 @@
{{ timerParts(0) }} @@ -263,7 +263,7 @@
diff --git a/main.js b/main.js index 58c2084..60b31c6 100644 --- a/main.js +++ b/main.js @@ -174,14 +174,16 @@ let app = { this.sound.play(); }, timeText(minutes, padHours = 0) { + const prefix = minutes >= 0 ? '' : '-'; + minutes = Math.abs(minutes); if (minutes >= 60 || padHours > 0) { - return `${Math.floor(minutes / 60) + return `${prefix}${Math.floor(minutes / 60) .toFixed(0) .padStart(padHours, "0")}h${(minutes % 60) .toFixed(0) .padStart(2, "0")}`; } else { - return `${(minutes % 60).toFixed(0).padStart(2, "0")}min`; + return `${prefix}${(minutes % 60).toFixed(0).padStart(2, "0")}min`; } }, spin() { @@ -207,8 +209,8 @@ let app = { }, 5000); }, getSelected() { - if (this.svgData.length <= 1) { - return 0; + if (this.svgData.length === 1) { + return this.svgData[0].id; } const angle = 360 - (this.wheelPosition % 360); for (let index = 0; index < this.svgData.length; index++) {