commit 0a4f889ba87bd4a88286ae8b451ecb5311dc0497
parent 6cb72536c544a6a7eaf1e5bd40b8352095a74e95
Author: Jacob R. Edwards <jacob@jacobedwards.org>
Date: Sun, 10 Mar 2024 22:09:19 -0700
Display unended breaks properly
This is just a front-end fix to a backend problem, but it'll do for
now. I think ideally I would set the break end time in the data
itself if a break was started and not finished and the end time got
set.
Diffstat:
1 file changed, 10 insertions(+), 0 deletions(-)
diff --git a/pages/main.c b/pages/main.c
@@ -150,6 +150,16 @@ printtime(struct pagedata *pd, time_t *times, unsigned int len)
(status = khtml_closeelem(&pd->html, 1)) != KCGI_OK)
return status;
+ /*
+ * This should probably be done to the data itself so that
+ * future operations such as exporting have valid data. Or
+ * just make the data specification say that an end time
+ * with no break end time but a start break time mean the
+ * break end time is the end time.
+ */
+ if ((len - 1) == EndTime && times[BreakStartTime] && !times[BreakEndTime])
+ times[BreakEndTime] = times[EndTime];
+
for (i = 0; i < 4; ++i) {
if (i >= len || !times[i]) {
if ((status = khtml_elem(&pd->html, KELEM_TH)) != KCGI_OK)