class Helper::EstimatedCostPotentialSavingHelper
Public Instance Methods
estimated_cost( lighting_cost_current, heating_cost_current, hot_water_cost_current )
click to toggle source
# File lib/helper/estimated_cost_potential_saving_helper.rb, line 7 def estimated_cost( lighting_cost_current, heating_cost_current, hot_water_cost_current ) estimated_cost = [ lighting_cost_current, heating_cost_current, hot_water_cost_current, ].compact.map { |value| BigDecimal(value) }.sum sprintf("%.2f", estimated_cost) end
potential_saving( lighting_cost_potential, heating_cost_potential, hot_water_cost_potential, estimated_cost = BigDecimal(0) )
click to toggle source
# File lib/helper/estimated_cost_potential_saving_helper.rb, line 21 def potential_saving( lighting_cost_potential, heating_cost_potential, hot_water_cost_potential, estimated_cost = BigDecimal(0) ) potential_saving_sum = [ lighting_cost_potential, heating_cost_potential, hot_water_cost_potential, ].compact.map { |value| BigDecimal(value) }.sum potential_saving = BigDecimal(estimated_cost) - potential_saving_sum sprintf("%.2f", potential_saving) end