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, #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
261 262 263 264 265 266 267 268 269 |
# File 'lib/checkoff/internal/selector_classes/task.rb', line 261 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
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 |
# File 'lib/checkoff/internal/selector_classes/task.rb', line 273 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
255 256 257 |
# File 'lib/checkoff/internal/selector_classes/task.rb', line 255 def matches? fn?(selector, FUNCTION_NAME) end |