Browse Source

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).
stable
Craig Oates 2 years ago
parent
commit
949cee862c
  1. 30
      src/view.lisp

30
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")))))

Loading…
Cancel
Save