Class: Spree::PaymentMethodTransactionsConversionRateReport

Inherits:
Report
  • Object
show all
Defined in:
app/reports/spree/payment_method_transactions_conversion_rate_report.rb

Defined Under Namespace

Classes: PaymentMethodStateDistributionChart, Result

Constant Summary collapse

DEFAULT_SORTABLE_ATTRIBUTE =
:payment_method_name
HEADERS =
{ payment_method_name: :string, payment_state: :string, months_name: :string, count: :integer }
SEARCH_ATTRIBUTES =
{ start_date: :payments_created_from, end_date: :payments_created_to }
SORTABLE_ATTRIBUTES =
[:payment_method_name, :successful_payments_count, :failed_payments_count, :pending_payments_count, :invalid_payments_count]

Constants inherited from Report

Report::TIME_SCALES

Instance Attribute Summary

Attributes inherited from Report

#current_page, #paginate, #records_per_page, #reporting_period, #search, #sortable_attribute, #sortable_type, #total_records

Instance Method Summary collapse

Methods inherited from Report

#active_record_sort, deeplink, #deeplink_properties, #generate, #get_results, #header_sorted?, #initialize, #name, #paginated?, #pagination_required?, #set_sortable_attributes, #time_scale_columns, #time_scale_columns_to_s, #time_scale_selects, #total_pages

Constructor Details

This class inherits a constructor from Spree::Report

Instance Method Details

#report_queryObject



49
50
51
52
53
54
55
56
57
58
59
60
# File 'app/reports/spree/payment_method_transactions_conversion_rate_report.rb', line 49

def report_query
  Spree::Report::QueryFragments
    .from_subquery(payment_methods)
    .group(*time_scale_columns_to_s, 'payment_method_name', 'payment_state')
    .order(*time_scale_columns)
    .project(
      *time_scale_columns,
      'payment_method_name',
      'payment_state',
      'COUNT(payment_method_id) as count'
    )
end