Class: Spree::PaymentMethodTransactionsReport::Result

Inherits:
Report::TimedResult show all
Defined in:
app/reports/spree/payment_method_transactions_report.rb

Defined Under Namespace

Classes: Observation

Instance Attribute Summary

Attributes inherited from Report::Result

#end_date, #observations, #report, #start_date, #time_scale

Instance Method Summary collapse

Methods inherited from Report::TimedResult

#build_report_observations, #headers, #populate_observations

Methods inherited from Report::Result

#build_report_observations, #chart_json, charts, #headers, #initialize, #populate_observations, #query_results, #search_attributes, #time_dimension, #to_h, #total_pages

Constructor Details

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

Instance Method Details

#build_empty_observationsObject



11
12
13
14
15
16
17
18
19
20
21
22
# File 'app/reports/spree/payment_method_transactions_report.rb', line 11

def build_empty_observations
  super
  @_payment_methods = @results.collect { |result| result['payment_method_name'] }.uniq
  @observations = @_payment_methods.collect do |payment_method_name|
    @observations.collect do |observation|
      _d_observation = observation.dup
      _d_observation.payment_amount = 0
      _d_observation.payment_method_name = payment_method_name
      _d_observation
    end
  end.flatten
end