From ab14b7e4b6efdc69ba9b21cacb2d4840bf7351b1 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Sun, 7 Jul 2019 13:02:15 +0100 Subject: Allow events to be scheduled for today if there's time --- scripts/toy/social.groovy | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scripts') diff --git a/scripts/toy/social.groovy b/scripts/toy/social.groovy index 384b0a2..0a6c179 100644 --- a/scripts/toy/social.groovy +++ b/scripts/toy/social.groovy @@ -6,7 +6,7 @@ toy.metaClass.setupPlan { plan, float startmin, float startmax, float endmin, float endmax -> final timeWindow = { float min, float max -> (int)((min * HOUR) - localTimeOffset() + getRandom((int)((max - min) * HOUR))) }; final friendName = FRIENDS[getRandom(FRIENDS.size())]; - final day = getDay() + ((getRandom(3) + 1) * DAY); + final day = getDay() + ((getRandom(3) + (localTime() > startmin ? 1 : 0)) * DAY); addEventIfMissing(plan, day + timeWindow(startmin, startmax), BEGINPLAN, [friendName: friendName, returnTime: day + timeWindow(endmin, endmax)]); } -- cgit v1.2.3