Psst.. new poll here.
Psst.. new forums here.
Microsoft is blocking us again (TY IP Reputation!) so just use oauth login instead. :)
Paste
Pasted as Lisp by deanz ( 15 years ago )
(defun render-location-hours-for-week (location)
(let* ((output "Hours:<br>")
(schedule (location-active-schedule location (get-time)))
(monday-date (midnight (get-time))))
(loop for i from 0 to 6
do (let* ((date (roll monday-date :day i))
(hours (multiple-value-list
(case (get-property schedule :schedule-type)
(:weekly
(open-close schedule :dow (time-dow date)))
(:biweekly
(open-close schedule :day (mod
(- (time-mjd date)
(time-mjd (get-property schedule :schedule-start)))
(get-property schedule :schedule-length))))
(t (open-close schedule :day (- (time-mjd date)
(time-mjd (get-property schedule :schedule-start)))))))))
(destructuring-bind (&optional; open close)
hours
(if (and open close)
(let* ((day-name (clsql-sys::day-name (time-dow date)))
(open-time (wco::map-to-string (make-instance 'wco::int-tod-mapper) open))
(close-time (wco::map-to-string (make-instance 'wco::int-tod-mapper) close))
(curr-hrs (format nil "~a: ~a to ~a<br>" day-name open-time close-time)))
(cmsg "curr-hrs: ~a" curr-hrs)
(concatenate 'string output curr-hrs)
(concatenate 'string output (format nil "~a: Closed<br>" (clsql-sys::day-name (time-dow date)))))))))
output))
Revise this Paste