better info

This commit is contained in:
Klemek
2024-11-11 22:57:45 +01:00
parent 23adffde0b
commit 6b7b4987d8
2 changed files with 37 additions and 23 deletions
+11 -3
View File
@@ -21,12 +21,20 @@
<br /> <br />
<ul> <ul>
<li> <li>
Remaining meeting time: <b>{{ timeText(totalRemainingTime) }}</b> Meeting duration so far: <b :id="rid + 1">{{ timeText(elapsedTime) }}</b>
</li> </li>
<li> <li>
End estimated at: <b>{{ timeText(estimatedEnd) }}</b> Remaining meeting time: <b :id="rid + 2">{{ timeText(totalRemainingTime) }}</b>
</li>
<li>
End estimated at: <b :id="rid + 3">{{ timeText(estimatedEnd) }}</b>
</li>
<li>
Total meeting time: <b :id="rid + 4">{{ timeText(totalTime) }}</b>
</li>
<li>
Overtime: <b :id="rid + 5">{{ timeText(overtimeTime) }}</b>
</li> </li>
<li>Total meeting time: <b>{{ timeText(totalTime) }}</b></li>
<li> <li>
<label for="wheighted">Wheighted topics</label>&nbsp;<input <label for="wheighted">Wheighted topics</label>&nbsp;<input
id="wheighted" id="wheighted"
+17 -11
View File
@@ -11,6 +11,9 @@ let app = {
selected: 0, selected: 0,
timerEnd: new Date(), timerEnd: new Date(),
timerStarted: false, timerStarted: false,
date: new Date(),
meetingStart: new Date(),
elapsedTime: 0,
initialSpin: true, initialSpin: true,
initialColor: Math.random() * 360, initialColor: Math.random() * 360,
rid: 0, rid: 0,
@@ -36,22 +39,20 @@ let app = {
return this.data.filter((item) => !item.disabled); return this.data.filter((item) => !item.disabled);
}, },
totalTime() { totalTime() {
return this.data.map((item) => item.time).reduce((a, b) => a + b, 0); return this.elapsedTime + this.data.map((item) => item.time).reduce((a, b) => a + b, 0);
}, },
totalRemainingTime() { totalRemainingTime() {
return this.filteredData return this.filteredData
.map((item) => item.time) .map((item) => item.time)
.reduce((a, b) => a + b, 0); .reduce((a, b) => a + b, 0);
}, },
overtimeTime() {
return this.totalTime - this.totalRemainingTime;
},
estimatedEnd() { estimatedEnd() {
const delta = this.timerStarted const end = new Date(this.meetingStart.getTime());
? ((this.timerEnd - new Date()) / (1000 * 60)) const timerDelta = (this.timerEnd - this.date) / (1000 * 60);
: this.showSelected end.setMinutes(end.getMinutes() + this.totalTime - (this.timerStarted ? timerDelta : 0));
? this.selectedData.time
: 0;
const toAdd = (this.totalRemainingTime - (this.showSelected ? this.selectedData.time : 0) + delta);
const end = new Date();
end.setMinutes(end.getMinutes() + toAdd);
return end.getHours() * 60 + end.getMinutes(); return end.getHours() * 60 + end.getMinutes();
}, },
svgData() { svgData() {
@@ -119,17 +120,20 @@ let app = {
}, },
timeText(minutes) { timeText(minutes) {
if (minutes > 60) { if (minutes > 60) {
return `${Math.floor(minutes / 60)}h${String(minutes % 60).padStart( return `${Math.floor(minutes / 60).toFixed(0)}h${(minutes % 60).toFixed(0).padStart(
2, 2,
"0" "0"
)}`; )}`;
} else { } else {
return `${String(minutes % 60).padStart(2, "0")}min`; return `${(minutes % 60).toFixed(0).padStart(2, "0")}min`;
} }
}, },
spin() { spin() {
if (this.timerStarted) return; if (this.timerStarted) return;
this.showSelected = false; this.showSelected = false;
if (this.initialSpin) {
this.meetingStart = new Date();
}
this.initialSpin = false; this.initialSpin = false;
this.wheelPosition += 360 * 10 + Math.random() * 360; this.wheelPosition += 360 * 10 + Math.random() * 360;
clearTimeout(this.timeoutId); clearTimeout(this.timeoutId);
@@ -243,6 +247,8 @@ let app = {
if (this.timerStarted) { if (this.timerStarted) {
document.title = this.timerText(); document.title = this.timerText();
} }
this.elapsedTime = (new Date() - this.meetingStart) / (1000 * 60);
this.date = new Date();
}, 200); }, 200);
}, },
}; };