Class: Checkoff::SelectorClasses::Task::EstimateExceedsDurationPFunctionEvaluator
Overview
:estimate_exceeds_duration?
Constant Summary
collapse
- FUNCTION_NAME =
:estimate_exceeds_duration?
Instance Method Summary
collapse
#initialize
#evaluate_arg?
Instance Method Details
#calculate_allocated_hours(task) ⇒ Float
213
214
215
216
217
218
219
220
221
222
|
# File 'lib/checkoff/internal/selector_classes/task.rb', line 213
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
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
|
# File 'lib/checkoff/internal/selector_classes/task.rb', line 226
def evaluate(task)
custom_field = @custom_fields.resource_custom_field_by_name(task, 'Estimated time')
return false if custom_field.nil?
estimate_minutes = custom_field.fetch('number_value')
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
207
208
209
|
# File 'lib/checkoff/internal/selector_classes/task.rb', line 207
def matches?
fn?(selector, FUNCTION_NAME)
end
|