From 7f16e1c1d30f56d796b1e7f2286c9ccfdd97061f Mon Sep 17 00:00:00 2001 From: Lukas Fleischer Date: Mon, 26 Nov 2012 02:01:56 +0100 Subject: day.c: Fix weekly view Calculate busy slices correctly if (recurrent) appointments with a duration of more than 24 hours are used. Signed-off-by: Lukas Fleischer --- src/day.c | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/day.c b/src/day.c index 29c03e4..70f1400 100644 --- a/src/day.c +++ b/src/day.c @@ -507,6 +507,11 @@ unsigned day_chk_busy_slices(struct date day, int slicesno, int *slices) long start = get_item_time(rapt->start); long end = get_item_time(rapt->start + rapt->dur); + if (rapt->start < date) + start = 0; + if (rapt->start + rapt->dur >= date + DAYINSEC) + end = DAYINSEC - 1; + if (!fill_slices(slices, slicesno, SLICENUM(start), SLICENUM(end))) { LLIST_TS_UNLOCK(&recur_alist_p); return 0; @@ -522,6 +527,10 @@ unsigned day_chk_busy_slices(struct date day, int slicesno, int *slices) if (apt->start >= date + DAYINSEC) break; + if (apt->start < date) + start = 0; + if (apt->start + apt->dur >= date + DAYINSEC) + end = DAYINSEC - 1; if (!fill_slices(slices, slicesno, SLICENUM(start), SLICENUM(end))) { LLIST_TS_UNLOCK(&alist_p); -- cgit v1.2.3