Class: InterventionAgent

Inherits:
InterventionProductParameter show all
Defined in:
app/models/intervention_agent.rb

Overview

This class is used for all intervenants that make the interventions. It gathers tools and doers.

Direct Known Subclasses

InterventionDoer, InterventionTool

Instance Method Summary collapse

Methods inherited from InterventionProductParameter

#default_name, #human_quantity, #measurable?, #name, #quantity_handler_reference, role, #role, #runnable?, #set_default_name!, #working_zone_svg

Methods inherited from InterventionParameter

#cost, #earn, #earn_amount_computation, #reference, #runnable?

Methods inherited from Ekylibre::Record::Base

#already_updated?, attr_readonly_with_conditions, #check_if_destroyable?, #check_if_updateable?, columns_definition, complex_scopes, customizable?, #customizable?, #customized?, #destroyable?, #editable?, has_picture, #human_attribute_name, human_attribute_name_with_id, nomenclature_reflections, #old_record, #others, refers_to, scope_with_registration, simple_scopes, #updateable?

Instance Method Details

#cost_amount_computationObject


60
61
62
63
64
65
66
67
68
69
# File 'app/models/intervention_agent.rb', line 60

def cost_amount_computation
  return InterventionParameter::AmountComputation.failed unless product
  options = {
    catalog_usage: :cost,
    quantity: working_duration.to_d / 3600,
    unit_name: Nomen::Unit.find(:hour).human_name
  }
  options[:catalog_item] = product.default_catalog_item(options[:catalog_usage])
  InterventionParameter::AmountComputation.quantity(:catalog, options)
end