lib/checkoff/internal/task_selector_evaluator.rb in checkoff-0.45.0 vs lib/checkoff/internal/task_selector_evaluator.rb in checkoff-0.45.1
- old
+ new
@@ -347,11 +347,15 @@
# @param num_days [Integer]
# @return [Boolean]
def evaluate(task, custom_field_name, num_days)
custom_field = pull_custom_field_by_name_or_raise(task, custom_field_name)
+ # @sg-ignore
+ # @type [String, nil]
time_str = custom_field.fetch('display_value')
+ return false if time_str.nil?
+
time = Time.parse(time_str)
n_days_from_now = (Time.now + (num_days * 24 * 60 * 60))
time < n_days_from_now
end
end
@@ -373,11 +377,15 @@
# @param num_days [Integer]
# @return [Boolean]
def evaluate(task, custom_field_name, num_days)
custom_field = pull_custom_field_by_name_or_raise(task, custom_field_name)
+ # @sg-ignore
+ # @type [String, nil]
time_str = custom_field.fetch('display_value')
+ return false if time_str.nil?
+
time = Time.parse(time_str)
n_days_from_now = (Time.now + (num_days * 24 * 60 * 60))
time >= n_days_from_now
end
end
@@ -427,14 +435,13 @@
# @param task_selector [Array]
# @return [Boolean, Object, nil]
def evaluate(task_selector)
return true if task_selector.empty?
- # @param evaluator_class [Class<FunctionEvaluator>]
+ # @param evaluator_class [Class<TaskSelectorClasses::FunctionEvaluator>]
FUNCTION_EVALUTORS.each do |evaluator_class|
# @sg-ignore
- # @type [FunctionEvaluator]
evaluator = evaluator_class.new(task_selector: task_selector,
tasks: tasks)
next unless evaluator.matches?
@@ -446,10 +453,10 @@
private
# @sg-ignore
# @param task_selector [Array]
- # @param evaluator [FunctionEvaluator]
+ # @param evaluator [TaskSelectorClasses::FunctionEvaluator]
# @return [Boolean, Object, nil]
def try_this_evaluator(task_selector, evaluator)
# if task_selector is an array
evaluated_args = if task_selector.is_a?(Array)
task_selector[1..].map.with_index do |item, index|