Class: Checkoff::SelectorClasses::Task::LastStoryCreatedLessThanNDaysAgoPFunctionEvaluator
- Inherits:
-
FunctionEvaluator
- Object
- FunctionEvaluator
- FunctionEvaluator
- Checkoff::SelectorClasses::Task::LastStoryCreatedLessThanNDaysAgoPFunctionEvaluator
- Defined in:
- lib/checkoff/internal/selector_classes/task.rb
Overview
:last_story_created_less_than_n_days_ago? function
Constant Summary collapse
- FUNCTION_NAME =
:last_story_created_less_than_n_days_ago?
Instance Method Summary collapse
- #evaluate(task, num_days, excluding_resource_subtypes) ⇒ Boolean
- #evaluate_arg?(_index) ⇒ Boolean
- #matches? ⇒ Boolean
Methods inherited from FunctionEvaluator
Methods included from Logging
#debug, #error, #finer, #info, #logger, #warn
Constructor Details
This class inherits a constructor from Checkoff::SelectorClasses::Task::FunctionEvaluator
Instance Method Details
#evaluate(task, num_days, excluding_resource_subtypes) ⇒ Boolean
233 234 235 236 237 238 239 240 241 242 243 244 245 246 |
# File 'lib/checkoff/internal/selector_classes/task.rb', line 233 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(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 last_story_created_at = Time.parse(last_story.created_at) n_days_ago = Time.now - (num_days * 24 * 60 * 60) last_story_created_at < n_days_ago end |
#evaluate_arg?(_index) ⇒ Boolean
225 226 227 |
# File 'lib/checkoff/internal/selector_classes/task.rb', line 225 def evaluate_arg?(_index) false end |
#matches? ⇒ Boolean
221 222 223 |
# File 'lib/checkoff/internal/selector_classes/task.rb', line 221 def matches? fn?(selector, FUNCTION_NAME) end |