Class: Report::SourcesReport::SourcesReportCommand

Inherits:
BaseCommand
  • Object
show all
Defined in:
app/services/report/sources_report/sources_report_command.rb

Overview

Service object: sources report command.

Constant Summary collapse

BASELINE_PERIOD_OPTIONS =

Available baseline period options.

[["current month", 1], ["current quarter", 2], ["current year", 3], ["last month", 4], ["last quarter", 5], ["last 3 months", 6], ["last 12 months", 7]].freeze
COMPARISON_PERIOD_OPTIONS =

Available comparison period options.

[["compare to previous period this year", 1], ["compare to last year same period", 2]].freeze

Instance Method Summary collapse

Instance Method Details

#executeObject

Run the report with the given filters and store the result.

Returns:

  • (Object)


20
21
22
23
24
25
# File 'app/services/report/sources_report/sources_report_command.rb', line 20

def execute
  return unless valid?

  check_for_warnings
  @result = Report::SourcesReport::SourcesReport.result_report(attributes)
end

#success?Boolean

Whether the command validated and ran successfully.

Returns:

  • (Boolean)


29
30
31
# File 'app/services/report/sources_report/sources_report_command.rb', line 29

def success?
  valid? && @result.success?
end