Compare commits
3 Commits
12c4553c81
...
d77ed7ed31
| Author | SHA1 | Date | |
|---|---|---|---|
| d77ed7ed31 | |||
| bcf994ab7b | |||
| 936ce2fc96 |
2
app.py
2
app.py
@@ -27,7 +27,7 @@ def index():
|
|||||||
if d.strip().isdigit()
|
if d.strip().isdigit()
|
||||||
]
|
]
|
||||||
|
|
||||||
update_interval = int(os.getenv("UPDATE_INTERVAL_MS", "60000"))
|
update_interval = int(os.getenv("UPDATE_INTERVAL_MS", "10"))
|
||||||
|
|
||||||
return render_template(
|
return render_template(
|
||||||
"index.html",
|
"index.html",
|
||||||
|
|||||||
@@ -49,9 +49,9 @@
|
|||||||
const WORK_DAYS = config.workDays;
|
const WORK_DAYS = config.workDays;
|
||||||
const UPDATE_INTERVAL = config.updateInterval;
|
const UPDATE_INTERVAL = config.updateInterval;
|
||||||
|
|
||||||
const TOTAL_WORK_MINUTES =
|
const TOTAL_WORK_SECONDS =
|
||||||
(WORK_END_HOUR * 60 + WORK_END_MINUTE) -
|
(WORK_END_HOUR * 3600 + WORK_END_MINUTE * 60) -
|
||||||
(WORK_START_HOUR * 60 + WORK_START_MINUTE);
|
(WORK_START_HOUR * 3600 + WORK_START_MINUTE * 60);
|
||||||
|
|
||||||
const WEEKLY_DAY_WEIGHT = 100 / WORK_DAYS.length;
|
const WEEKLY_DAY_WEIGHT = 100 / WORK_DAYS.length;
|
||||||
|
|
||||||
@@ -83,9 +83,10 @@
|
|||||||
dailyPercent = 100;
|
dailyPercent = 100;
|
||||||
statusText.textContent = "Workday complete 🎉";
|
statusText.textContent = "Workday complete 🎉";
|
||||||
} else {
|
} else {
|
||||||
const elapsedMinutes = Math.floor((now - start) / 60000);
|
const elapsedSeconds = (now - start) / 1000;
|
||||||
|
|
||||||
dailyPercent = Math.min(
|
dailyPercent = Math.min(
|
||||||
(elapsedMinutes / TOTAL_WORK_MINUTES) * 100,
|
(elapsedSeconds / TOTAL_WORK_SECONDS) * 100,
|
||||||
100
|
100
|
||||||
);
|
);
|
||||||
statusText.textContent = "Grinding…";
|
statusText.textContent = "Grinding…";
|
||||||
@@ -93,7 +94,7 @@
|
|||||||
|
|
||||||
// Daily progress
|
// Daily progress
|
||||||
dailyFill.style.width = dailyPercent + "%";
|
dailyFill.style.width = dailyPercent + "%";
|
||||||
dailyPercentText.textContent = dailyPercent.toFixed(1) + "%";
|
dailyPercentText.textContent = dailyPercent.toFixed(4) + "%";
|
||||||
|
|
||||||
// Weekly progress
|
// Weekly progress
|
||||||
const completedDays = WORK_DAYS.filter(d => d < day).length;
|
const completedDays = WORK_DAYS.filter(d => d < day).length;
|
||||||
@@ -104,7 +105,7 @@
|
|||||||
weeklyPercent = Math.min(weeklyPercent, 100);
|
weeklyPercent = Math.min(weeklyPercent, 100);
|
||||||
|
|
||||||
weeklyFill.style.width = weeklyPercent + "%";
|
weeklyFill.style.width = weeklyPercent + "%";
|
||||||
weeklyPercentText.textContent = weeklyPercent.toFixed(1) + "%";
|
weeklyPercentText.textContent = weeklyPercent.toFixed(4) + "%";
|
||||||
}
|
}
|
||||||
|
|
||||||
updateProgress();
|
updateProgress();
|
||||||
|
|||||||
Reference in New Issue
Block a user