Class: Checkoff::SelectorClasses::Task::EstimateExceedsDurationPFunctionEvaluator
- Inherits:
-
FunctionEvaluator
- Object
- FunctionEvaluator
- FunctionEvaluator
- Checkoff::SelectorClasses::Task::EstimateExceedsDurationPFunctionEvaluator
- Defined in:
- lib/checkoff/internal/selector_classes/task.rb
Overview
:estimate_exceeds_duration?
Constant Summary collapse
- FUNCTION_NAME =
:estimate_exceeds_duration?
Instance Method Summary collapse
Methods inherited from FunctionEvaluator
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
#calculate_allocated_hours(task) ⇒ Float
259 260 261 262 263 264 265 266 267 268 |
# File 'lib/checkoff/internal/selector_classes/task.rb', line 259 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 # @sg-ignore allocated_hours = (due_on - start_on + 1).to_i * 8.0 if start_on && due_on allocated_hours end |
#evaluate(task) ⇒ Boolean
272 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 272 def evaluate(task) custom_field = @custom_fields.resource_custom_field_by_name(task, 'Estimated time') return false if custom_field.nil? # @sg-ignore # @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
253 254 255 |
# File 'lib/checkoff/internal/selector_classes/task.rb', line 253 def matches? fn?(selector, FUNCTION_NAME) end |