From 949cee862cac22975721a7747d5dbde27fe8763c Mon Sep 17 00:00:00 2001 From: Craig Oates Date: Sat, 8 Oct 2022 12:56:19 +0100 Subject: [PATCH] refactor insert-dashboard-cat filter (view.lisp). Changes the time conditions used to display the various cat icons in the dashboard; And, fix a bracket-bug (closed a condition block too early). --- src/view.lisp | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/src/view.lisp b/src/view.lisp index 039cd90..4ddb096 100644 --- a/src/view.lisp +++ b/src/view.lisp @@ -96,31 +96,31 @@ (defun insert-dashboard-cat () (let ((timestamp (local-time:now))) - (cond ((and (> (local-time:timestamp-hour timestamp) 6) - (<= (local-time:timestamp-hour timestamp) 10)) + (cond ((and (>= (local-time:timestamp-hour timestamp) 6) + (< (local-time:timestamp-hour timestamp) 10)) (format nil "/images/icons/morning-cat.png")) - ((and (> (local-time:timestamp-hour timestamp) 10) - (<= (local-time:timestamp-hour timestamp)) 12) + ((and (>= (local-time:timestamp-hour timestamp) 10) + (< (local-time:timestamp-hour timestamp) 12)) (format nil "/images/icons/coffee-cat.png")) - ((and (> (local-time:timestamp-hour timestamp) 12) - (<= (local-time:timestamp-hour timestamp) 14)) + ((and (>= (local-time:timestamp-hour timestamp) 12) + (< (local-time:timestamp-hour timestamp) 14)) (format nil "/images/icons/dinner-cat.png")) - ((and (> (local-time:timestamp-hour timestamp) 14) - (<= (local-time:timestamp-hour timestamp) 18)) + ((and (>= (local-time:timestamp-hour timestamp) 14) + (< (local-time:timestamp-hour timestamp) 18)) (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) + ((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")))) - ((and (> (local-time:timestamp-hour timestamp) 20) - (<= (local-time:timestamp-hour timestamp) 22)) + ((and (>= (local-time:timestamp-hour timestamp) 20) + (< (local-time:timestamp-hour timestamp) 22)) (format nil "/images/icons/dinner-cat.png")) - ((and (> (local-time:timestamp-hour timestamp) 22) - (<= (local-time:timestamp-hour timestamp) 24)) + ((and (>= (local-time:timestamp-hour timestamp) 22) + (< (local-time:timestamp-hour timestamp) 24)) (format nil "/images/icons/bed-time-cat.png")) (t (format nil "/images/icons/default-cat.png")))))