diff options
| author | Matthew Fennell <matthew@fennell.dev> | 2026-04-16 18:30:17 +0100 |
|---|---|---|
| committer | Matthew Fennell <matthew@fennell.dev> | 2026-04-16 18:35:06 +0100 |
| commit | 1a86583160fbf10a68828958e80a7aa52e5c9db8 (patch) | |
| tree | 07e615806a56bc26a7af46e7bf25f54a876f1bcf /shuttlebot.scm | |
| parent | 824f10b7301d8053212b8b2f0dcf105b0c41f28c (diff) | |
Do not check for new slots in the next 3 daysmain
This is in order to prevent last-minute booking switches.
Diffstat (limited to 'shuttlebot.scm')
| -rwxr-xr-x | shuttlebot.scm | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/shuttlebot.scm b/shuttlebot.scm index 3672ae2..6985323 100755 --- a/shuttlebot.scm +++ b/shuttlebot.scm @@ -52,12 +52,15 @@ (venues default-venues) (activities default-activities) (dates default-dates) + (min-lookahead-days default-min-lookahead-days) (token #f)) (let* ((venues (map symbol->string venues)) (activities (map symbol->string activities)) + (today (10pm-adjusted-date (current-date))) + (ignored-dates (days-after today min-lookahead-days)) (dates (map this dates)) - (dates (filter (lambda (d) (not (equal? d (date-date (current-date))))) dates)) + (dates (filter (lambda (d) (not (any (cut equal? d <>) ignored-dates))) dates)) (dates (map date->api-string dates)) (permutations (cartesian-product venues activities dates)) (positive-spaces? (lambda (t) ((compose positive? time-data-spaces) t))) @@ -173,7 +176,7 @@ (let* ((token (login user)) (existing (scored (bookings #:venues venues #:activities activities #:dates dates #:token token))) (best-existing (reduce max-score fake-score existing)) - (new (scored (times #:venues venues #:activities activities #:dates dates #:token token))) + (new (scored (times #:venues venues #:activities activities #:dates dates #:min-lookahead-days default-min-lookahead-days #:token token))) (best-new (reduce max-score fake-score new))) (log-msg 'INFO "Best new booking: " (first best-new) " with score " (second best-new)) (log-msg 'INFO "Best existing booking: " (first best-existing) " with score " (second best-existing)) |
