Class: Spree::ShippingCostReport::Result::Observation

Inherits:
Report::TimedObservation show all
Defined in:
app/reports/spree/shipping_cost_report.rb

Instance Attribute Summary

Attributes inherited from Report::TimedObservation

#date, #hour, #reportable_keys

Instance Method Summary collapse

Methods inherited from Report::TimedObservation

#day_name, #hour_name, #initialize, #month_name, #to_h

Methods inherited from Report::Observation

build_from_hash, build_from_list, #initialize, observation_fields, #to_h

Constructor Details

This class inherits a constructor from Spree::Report::TimedObservation

Instance Method Details

#describes?(result, time_scale) ⇒ Boolean

Returns:

  • (Boolean)


28
29
30
# File 'app/reports/spree/shipping_cost_report.rb', line 28

def describes?(result, time_scale)
  (name = result['name']) && super
end

#shipping_cost_percentageObject



32
33
34
# File 'app/reports/spree/shipping_cost_report.rb', line 32

def shipping_cost_percentage
  ((@shipping_charge.to_f * 100) / @revenue.to_f).round(2)
end