Class: Checkoff::SelectorClasses::Task::EstimateExceedsDurationPFunctionEvaluator
- Inherits:
-
FunctionEvaluator
- Object
- FunctionEvaluator
- FunctionEvaluator
- Checkoff::SelectorClasses::Task::EstimateExceedsDurationPFunctionEvaluator
- Defined in:
- lib/checkoff/internal/selector_classes/task.rb,
sig/checkoff.rbs
Overview
:estimate_exceeds_duration?
Constant Summary collapse
- FUNCTION_NAME =
:estimate_exceeds_duration?
Instance Attribute Summary
Attributes inherited from FunctionEvaluator
#custom_fields, #selector, #tasks, #timelines
Instance Method Summary collapse
-
#calculate_allocated_hours(task) ⇒ Float
sord warn - Asana::Resources::Task wasn't able to be resolved to a constant in this project @param
task. -
#evaluate(task) ⇒ Boolean
sord warn - Asana::Resources::Task wasn't able to be resolved to a constant in this project @param
task. - #matches? ⇒ Boolean
Methods inherited from FunctionEvaluator
Methods inherited from FunctionEvaluator
#debug, #error, #evaluate_arg?, #finer, #fn?, #info, #initialize, #log_level, #logger, #warn
Methods included from Logging
#debug, #error, #finer, #info, #log_level, #logger, #warn
Constructor Details
This class inherits a constructor from Checkoff::SelectorClasses::Task::FunctionEvaluator
Instance Method Details
#calculate_allocated_hours(task) ⇒ Float
sord warn - Asana::Resources::Task wasn't able to be resolved to a constant in this project
@param task
285 286 287 288 289 290 291 292 293 |
# File 'lib/checkoff/internal/selector_classes/task.rb', line 285 def calculate_allocated_hours(task) due_on = nil start_on = nil start_on = Date.parse(task.start_on) unless task.start_on.nil? due_on = Date.parse(task.due_on) unless task.due_on.nil? allocated_hours = 8.0 allocated_hours = (due_on - start_on + 1).to_i * 8.0 if start_on && due_on allocated_hours end |
#evaluate(task) ⇒ Boolean
sord warn - Asana::Resources::Task wasn't able to be resolved to a constant in this project
@param task
297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 |
# File 'lib/checkoff/internal/selector_classes/task.rb', line 297 def evaluate(task) custom_field = custom_fields.resource_custom_field_by_name(task, 'Estimated time') return false if custom_field.nil? # @type [Integer, nil] estimate_minutes = custom_field.fetch('number_value') # no estimate set return false if estimate_minutes.nil? estimate_hours = estimate_minutes / 60.0 allocated_hours = calculate_allocated_hours(task) estimate_hours > allocated_hours end |
#matches? ⇒ Boolean
279 280 281 |
# File 'lib/checkoff/internal/selector_classes/task.rb', line 279 def matches? fn?(selector, FUNCTION_NAME) end |