Class: Marketing::CampaignInfluence::Result
- Inherits:
-
Data
- Object
- Data
- Marketing::CampaignInfluence::Result
- Defined in:
- app/queries/marketing/campaign_influence.rb
Instance Attribute Summary collapse
-
#distinct_influenced_invoices ⇒ Object
readonly
Returns the value of attribute distinct_influenced_invoices.
-
#distinct_influenced_revenue ⇒ Object
readonly
Returns the value of attribute distinct_influenced_revenue.
-
#end_date ⇒ Object
readonly
Returns the value of attribute end_date.
-
#period_invoices ⇒ Object
readonly
Returns the value of attribute period_invoices.
-
#period_revenue ⇒ Object
readonly
Returns the value of attribute period_revenue.
-
#rows ⇒ Array<Row>
readonly
Campaigns with at least one touched invoice, richest influence first.
-
#start_date ⇒ Object
readonly
Returns the value of attribute start_date.
-
#window_days ⇒ Object
readonly
Returns the value of attribute window_days.
Instance Method Summary collapse
-
#always_on ⇒ Array<Row>
Campaigns whose reach is too broad to rank on.
-
#discriminating ⇒ Array<Row>
The rows worth ranking against each other.
-
#revenue_is_summable? ⇒ Boolean
Guards against a caller summing Marketing::CampaignInfluence::Row#influenced_revenue across rows.
Instance Attribute Details
#distinct_influenced_invoices ⇒ Object (readonly)
Returns the value of attribute distinct_influenced_invoices
99 100 101 |
# File 'app/queries/marketing/campaign_influence.rb', line 99 def distinct_influenced_invoices @distinct_influenced_invoices end |
#distinct_influenced_revenue ⇒ Object (readonly)
Returns the value of attribute distinct_influenced_revenue
99 100 101 |
# File 'app/queries/marketing/campaign_influence.rb', line 99 def distinct_influenced_revenue @distinct_influenced_revenue end |
#end_date ⇒ Object (readonly)
Returns the value of attribute end_date
99 100 101 |
# File 'app/queries/marketing/campaign_influence.rb', line 99 def end_date @end_date end |
#period_invoices ⇒ Object (readonly)
Returns the value of attribute period_invoices
99 100 101 |
# File 'app/queries/marketing/campaign_influence.rb', line 99 def period_invoices @period_invoices end |
#period_revenue ⇒ Object (readonly)
Returns the value of attribute period_revenue
99 100 101 |
# File 'app/queries/marketing/campaign_influence.rb', line 99 def period_revenue @period_revenue end |
#rows ⇒ Array<Row> (readonly)
Returns campaigns with at least one touched invoice,
richest influence first.
99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'app/queries/marketing/campaign_influence.rb', line 99 Result = Data.define(:rows, :start_date, :end_date, :window_days, :period_invoices, :period_revenue, :distinct_influenced_invoices, :distinct_influenced_revenue) do # Guards against a caller summing {Row#influenced_revenue} across rows. # One deal can appear under several campaigns at full value, which is the # point of an influence list and the reason it is not a revenue split. # # @return [Boolean] def revenue_is_summable? = false # Campaigns whose reach is too broad to rank on. Not a data problem — # a nurturing programme legitimately touches most customers — but their # influence total says more about the programme's size than about any # deal, so they belong in their own bucket rather than at the top of a # league table. # # @return [Array<Row>] def always_on = rows.select(&:always_on?) # @return [Array<Row>] the rows worth ranking against each other def discriminating = rows.reject(&:always_on?) end |
#start_date ⇒ Object (readonly)
Returns the value of attribute start_date
99 100 101 |
# File 'app/queries/marketing/campaign_influence.rb', line 99 def start_date @start_date end |
#window_days ⇒ Object (readonly)
Returns the value of attribute window_days
99 100 101 |
# File 'app/queries/marketing/campaign_influence.rb', line 99 def window_days @window_days end |
Instance Method Details
#always_on ⇒ Array<Row>
Campaigns whose reach is too broad to rank on. Not a data problem —
a nurturing programme legitimately touches most customers — but their
influence total says more about the programme's size than about any
deal, so they belong in their own bucket rather than at the top of a
league table.
116 |
# File 'app/queries/marketing/campaign_influence.rb', line 116 def always_on = rows.select(&:always_on?) |
#discriminating ⇒ Array<Row>
Returns the rows worth ranking against each other.
119 |
# File 'app/queries/marketing/campaign_influence.rb', line 119 def discriminating = rows.reject(&:always_on?) |
#revenue_is_summable? ⇒ Boolean
Guards against a caller summing Marketing::CampaignInfluence::Row#influenced_revenue across rows.
One deal can appear under several campaigns at full value, which is the
point of an influence list and the reason it is not a revenue split.
107 |
# File 'app/queries/marketing/campaign_influence.rb', line 107 def revenue_is_summable? = false |