Class: Report::ChannelRevenue::Command
Constant Summary
Constants inherited
from BaseCommand
BaseCommand::ARRAY_TYPE_NAMES
Instance Attribute Summary
Attributes inherited from BaseCommand
#results
Instance Method Summary
collapse
Methods inherited from BaseCommand
#attributes, #email_parameters, #email_partial, #initialize
Instance Method Details
#execute ⇒ Object
22
23
24
25
26
27
28
29
30
31
|
# File 'app/services/report/channel_revenue/command.rb', line 22
def execute
return unless valid?
@results = Report::ChannelRevenue::Query.report(
period1_range: period1_range,
period2_range: period2_range,
primary_sales_rep_ids: primary_sales_rep_ids.presence,
invoice_types: invoice_types,
company_ids: company_ids,
consolidated_currency: consolidated_currency)
end
|
#invoice_types=(new_invoice_types) ⇒ Object
18
19
20
|
# File 'app/services/report/channel_revenue/command.rb', line 18
def invoice_types=(new_invoice_types)
super (new_invoice_types || []).map(&:presence).compact.uniq
end
|
#period1_humanized ⇒ Object
41
42
43
|
# File 'app/services/report/channel_revenue/command.rb', line 41
def period1_humanized
"From #{period1_range.first} until #{period1_range.last}"
end
|
#period1_range ⇒ Object
33
34
35
|
# File 'app/services/report/channel_revenue/command.rb', line 33
def period1_range
period1_gteq && period1_lteq && period1_gteq..period1_lteq
end
|
#period2_humanized ⇒ Object
45
46
47
|
# File 'app/services/report/channel_revenue/command.rb', line 45
def period2_humanized
"From #{period2_range.first} until #{period2_range.last}"
end
|
#period2_range ⇒ Object
37
38
39
|
# File 'app/services/report/channel_revenue/command.rb', line 37
def period2_range
period2_gteq && period2_lteq && period2_gteq..period2_lteq
end
|
#success? ⇒ Boolean
49
50
51
|
# File 'app/services/report/channel_revenue/command.rb', line 49
def success?
valid? && @results.present?
end
|