lib/checkoff/internal/task_selector_evaluator.rb in checkoff-0.55.0 vs lib/checkoff/internal/task_selector_evaluator.rb in checkoff-0.56.0

- old
+ new

@@ -161,10 +161,30 @@ def evaluate(_task, lhs, rhs) lhs && rhs end end + # :or function + # + # Does not yet shortcut, but may in future - be careful with side + # effects! + class OrFunctionEvaluator < FunctionEvaluator + FUNCTION_NAME = :or + + def matches? + fn?(task_selector, FUNCTION_NAME) + end + + # @param _task [Asana::Resources::Task] + # @param lhs [Object] + # @param rhs [Object] + # @return [Object] + def evaluate(_task, lhs, rhs) + lhs || rhs + end + end + # :not function class NotFunctionEvaluator < FunctionEvaluator FUNCTION_NAME = :not def matches? @@ -502,11 +522,11 @@ # @return [Boolean] def evaluate(task, num_days, excluding_resource_subtypes) # for whatever reason, .last on the enumerable does not impose ordering; .to_a does! # @type [Array<Asana::Resources::Story>] - stories = task.stories.to_a.reject do |story| + stories = task.stories(per_page: 100).to_a.reject do |story| excluding_resource_subtypes.include? story.resource_subtype end return true if stories.empty? # no stories == infinitely old! last_story = stories.last @@ -590,9 +610,10 @@ Checkoff::TaskSelectorClasses::CustomFieldValueFunctionEvaluator, Checkoff::TaskSelectorClasses::CustomFieldGidValueFunctionEvaluator, Checkoff::TaskSelectorClasses::CustomFieldGidValueContainsAnyGidFunctionEvaluator, Checkoff::TaskSelectorClasses::CustomFieldGidValueContainsAllGidsFunctionEvaluator, Checkoff::TaskSelectorClasses::AndFunctionEvaluator, + Checkoff::TaskSelectorClasses::OrFunctionEvaluator, Checkoff::TaskSelectorClasses::DuePFunctionEvaluator, Checkoff::TaskSelectorClasses::UnassignedPFunctionEvaluator, Checkoff::TaskSelectorClasses::DueDateSetPFunctionEvaluator, Checkoff::TaskSelectorClasses::FieldLessThanNDaysAgoFunctionEvaluator, Checkoff::TaskSelectorClasses::FieldGreaterThanOrEqualToNDaysFromTodayFunctionEvaluator,