summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthew Fennell <matthew@fennell.dev>2026-04-16 16:26:08 +0100
committerMatthew Fennell <matthew@fennell.dev>2026-04-16 18:34:56 +0100
commit824f10b7301d8053212b8b2f0dcf105b0c41f28c (patch)
treea770c81bbe2628eda3fcf9f93dbfdb3689c9282e
parent635960c4a470bbbd0f25120bdc65fa1b060f5b03 (diff)
Add days-after helper
Currently, shuttlebot doesn't take the number of days before the booking into consideration, apart from not changing bookings on today's date. To help with fixing this, add days-after Given a base date and number of days, it will produce a consecutive list of days. Then, when searching for available bookings, we can use this list to ask "is the date I'm booking for in the list of days-after?"
-rw-r--r--util.scm3
1 files changed, 3 insertions, 0 deletions
diff --git a/util.scm b/util.scm
index a550427..fad9451 100644
--- a/util.scm
+++ b/util.scm
@@ -10,6 +10,9 @@
(append-map
(lambda (x) (map (lambda (y) (cons x y)) ys)) xs)) '(()) lists))
+(define (days-after base-date min-lookahead-days)
+ (unfold (cut = <> min-lookahead-days) (cut date+ base-date <>) 1+ 0))
+
(define* (api-request #:key method path (query #f) (request #f) (transformer identity) (token #f))
(let*-values
(((record-name)