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()
|
||||
]
|
||||
|
||||
update_interval = int(os.getenv("UPDATE_INTERVAL_MS", "60000"))
|
||||
update_interval = int(os.getenv("UPDATE_INTERVAL_MS", "10"))
|
||||
|
||||
return render_template(
|
||||
"index.html",
|
||||
|
||||
@@ -49,9 +49,9 @@
|
||||
const WORK_DAYS = config.workDays;
|
||||
const UPDATE_INTERVAL = config.updateInterval;
|
||||
|
||||
const TOTAL_WORK_MINUTES =
|
||||
(WORK_END_HOUR * 60 + WORK_END_MINUTE) -
|
||||
(WORK_START_HOUR * 60 + WORK_START_MINUTE);
|
||||
const TOTAL_WORK_SECONDS =
|
||||
(WORK_END_HOUR * 3600 + WORK_END_MINUTE * 60) -
|
||||
(WORK_START_HOUR * 3600 + WORK_START_MINUTE * 60);
|
||||
|
||||
const WEEKLY_DAY_WEIGHT = 100 / WORK_DAYS.length;
|
||||
|
||||
@@ -83,17 +83,18 @@
|
||||
dailyPercent = 100;
|
||||
statusText.textContent = "Workday complete 🎉";
|
||||
} else {
|
||||
const elapsedMinutes = Math.floor((now - start) / 60000);
|
||||
const elapsedSeconds = (now - start) / 1000;
|
||||
|
||||
dailyPercent = Math.min(
|
||||
(elapsedMinutes / TOTAL_WORK_MINUTES) * 100,
|
||||
100
|
||||
(elapsedSeconds / TOTAL_WORK_SECONDS) * 100,
|
||||
100
|
||||
);
|
||||
statusText.textContent = "Grinding…";
|
||||
}
|
||||
|
||||
// Daily progress
|
||||
dailyFill.style.width = dailyPercent + "%";
|
||||
dailyPercentText.textContent = dailyPercent.toFixed(1) + "%";
|
||||
dailyPercentText.textContent = dailyPercent.toFixed(4) + "%";
|
||||
|
||||
// Weekly progress
|
||||
const completedDays = WORK_DAYS.filter(d => d < day).length;
|
||||
@@ -104,7 +105,7 @@
|
||||
weeklyPercent = Math.min(weeklyPercent, 100);
|
||||
|
||||
weeklyFill.style.width = weeklyPercent + "%";
|
||||
weeklyPercentText.textContent = weeklyPercent.toFixed(1) + "%";
|
||||
weeklyPercentText.textContent = weeklyPercent.toFixed(4) + "%";
|
||||
}
|
||||
|
||||
updateProgress();
|
||||
|
||||
Reference in New Issue
Block a user