File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22/jpm_tree
33/tags *
44/test /examples /* .bkp
5+ * .tested
Original file line number Diff line number Diff line change 3636 (not (day/has-task? day task ))))
3737 (plan/all-days-before plan date )))
3838
39+ (defn- older-than-30-days? [date today ]
40+ (date/before? date (date/-days today 30 )))
41+
3942# Public
4043(defn missed?
4144 ```
4245 Checks if the task was missed in the plan up to the passed date.
4346
4447 Returns true or false.
48+
49+ plan - The plan.
50+ task - The scheduled task.
51+ date - A date. Typically today.
4552 ```
4653 [plan task date ]
4754 (def day (missed-on-day plan task date ))
48- (and day (not (plan/has-task-after? plan task (day :date )))))
55+ (and day
56+ (not (older-than-30-days? (day :date ) date ))
57+ (not (plan/has-task-after? plan task (day :date )))))
4958
5059(defn- mark-tasks-as-missed [plan tasks date ]
5160 (map (fn [task ]
Original file line number Diff line number Diff line change 109109 (day/build-day (d/date 2022 7 15 ))]))
110110 (test (missed? plan scheduled-task (d/date 2022 8 3 )) true ))
111111
112+ (deftest " returns false when the task is missed, but it's older than 30 days"
113+ (def plan (plan/build-plan
114+ :days @[(day/build-day (d/date 2022 9 11 ))
115+ (day/build-day (d/date 2022 8 1 ))]))
116+ (test (not (missed? plan scheduled-task (d/date 2022 9 11 ))) true ))
117+
112118(deftest " returns false when the task is scheduled for another day"
113119 (def plan (plan/build-plan
114120 :days @[(day/build-day (d/date 2022 8 2 )
You can’t perform that action at this time.
0 commit comments