summaryrefslogtreecommitdiff
path: root/shuttlebot.scm
diff options
context:
space:
mode:
Diffstat (limited to 'shuttlebot.scm')
-rwxr-xr-xshuttlebot.scm7
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))