From 6a5b6ea838ec6a0f9d9ffdb386dc27ddbd4cfabe Mon Sep 17 00:00:00 2001 From: Craig Oates Date: Sun, 9 Oct 2022 21:15:05 +0100 Subject: [PATCH] fix day-of-week timestamp bug in insert-dashboard-cat filter. I didn't realise the local-time system set 'Sunday' to '0' in its timestamp-day-of-week function. I thought it was '7'. This commit changes the check for '7' to '0' and adds a few comments to help identify which days the cond form is checking against. --- src/view.lisp | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/src/view.lisp b/src/view.lisp index 4ddb096..d83ea2f 100644 --- a/src/view.lisp +++ b/src/view.lisp @@ -110,12 +110,16 @@ (format nil "/images/icons/study-cat.png")) ((and (>= (local-time:timestamp-hour timestamp) 18) (< (local-time:timestamp-hour timestamp) 20)) - (cond ((<= (local-time:timestamp-day-of-week timestamp) 5) - (format nil "/images/icons/workout-cat.png")) - ((= (local-time:timestamp-day-of-week timestamp) 6) - (format nil "/images/icons/rock-star-cat.png")) - ((= (local-time:timestamp-day-of-week timestamp) 7) - (format nil "/images/icons/love-cat.png")))) + (cond + ;; Sunday + ((= (local-time:timestamp-day-of-week timestamp) 0) + (format nil "/images/icons/love-cat.png")) + ;; Monday - Friday + ((<= (local-time:timestamp-day-of-week timestamp) 5) + (format nil "/images/icons/workout-cat.png")) + ;; Saturday + ((= (local-time:timestamp-day-of-week timestamp) 6) + (format nil "/images/icons/rock-star-cat.png")))) ((and (>= (local-time:timestamp-hour timestamp) 20) (< (local-time:timestamp-hour timestamp) 22)) (format nil "/images/icons/dinner-cat.png"))