Class: Marketing::CampaignInfluence::Row
- Inherits:
-
Data
- Object
- Data
- Marketing::CampaignInfluence::Row
- Defined in:
- app/queries/marketing/campaign_influence.rb
Overview
One campaign's influence over the period.
Instance Attribute Summary collapse
-
#campaign_id ⇒ Object
readonly
Returns the value of attribute campaign_id.
-
#campaign_name ⇒ Object
readonly
Returns the value of attribute campaign_name.
-
#influenced_invoices ⇒ Object
readonly
Returns the value of attribute influenced_invoices.
-
#influenced_revenue ⇒ Object
readonly
Returns the value of attribute influenced_revenue.
-
#net_new_invoices ⇒ Object
readonly
Returns the value of attribute net_new_invoices.
-
#period_revenue ⇒ Object
readonly
Returns the value of attribute period_revenue.
-
#source_id ⇒ Object
readonly
Returns the value of attribute source_id.
-
#sourced_invoices ⇒ Object
readonly
Returns the value of attribute sourced_invoices.
-
#sourced_revenue ⇒ Object
readonly
Returns the value of attribute sourced_revenue.
Instance Method Summary collapse
-
#always_on? ⇒ Boolean
Reach this broad stops discriminating between campaigns.
-
#coverage_of_period ⇒ Float
Share of ALL revenue in the period this campaign touched, 0.0..1.0.
- #influence_only_invoices ⇒ Integer
-
#influence_only_revenue ⇒ BigDecimal
Revenue the campaign touched but did NOT acquire.
Instance Attribute Details
#campaign_id ⇒ Object (readonly)
Returns the value of attribute campaign_id
61 62 63 |
# File 'app/queries/marketing/campaign_influence.rb', line 61 def campaign_id @campaign_id end |
#campaign_name ⇒ Object (readonly)
Returns the value of attribute campaign_name
61 62 63 |
# File 'app/queries/marketing/campaign_influence.rb', line 61 def campaign_name @campaign_name end |
#influenced_invoices ⇒ Object (readonly)
Returns the value of attribute influenced_invoices
61 62 63 |
# File 'app/queries/marketing/campaign_influence.rb', line 61 def influenced_invoices @influenced_invoices end |
#influenced_revenue ⇒ Object (readonly)
Returns the value of attribute influenced_revenue
61 62 63 |
# File 'app/queries/marketing/campaign_influence.rb', line 61 def influenced_revenue @influenced_revenue end |
#net_new_invoices ⇒ Object (readonly)
Returns the value of attribute net_new_invoices
61 62 63 |
# File 'app/queries/marketing/campaign_influence.rb', line 61 def net_new_invoices @net_new_invoices end |
#period_revenue ⇒ Object (readonly)
Returns the value of attribute period_revenue
61 62 63 |
# File 'app/queries/marketing/campaign_influence.rb', line 61 def period_revenue @period_revenue end |
#source_id ⇒ Object (readonly)
Returns the value of attribute source_id
61 62 63 |
# File 'app/queries/marketing/campaign_influence.rb', line 61 def source_id @source_id end |
#sourced_invoices ⇒ Object (readonly)
Returns the value of attribute sourced_invoices
61 62 63 |
# File 'app/queries/marketing/campaign_influence.rb', line 61 def sourced_invoices @sourced_invoices end |
#sourced_revenue ⇒ Object (readonly)
Returns the value of attribute sourced_revenue
61 62 63 |
# File 'app/queries/marketing/campaign_influence.rb', line 61 def sourced_revenue @sourced_revenue end |
Instance Method Details
#always_on? ⇒ Boolean
Reach this broad stops discriminating between campaigns.
93 |
# File 'app/queries/marketing/campaign_influence.rb', line 93 def always_on? = coverage_of_period >= ALWAYS_ON_COVERAGE |
#coverage_of_period ⇒ Float
Share of ALL revenue in the period this campaign touched, 0.0..1.0.
The base rate is not decoration — it is what makes the influence figure
readable. An always-on programme that touches half the company's invoices
tops any influence ranking by construction, so "$283k influenced" means
nothing until you know it is 38% of everything billed. Reporting the
revenue without this invites exactly the decision the number was built to
prevent.
84 85 86 87 88 |
# File 'app/queries/marketing/campaign_influence.rb', line 84 def coverage_of_period return 0.0 if period_revenue.to_f.zero? (influenced_revenue.to_f / period_revenue).round(4) end |
#influence_only_invoices ⇒ Integer
72 |
# File 'app/queries/marketing/campaign_influence.rb', line 72 def influence_only_invoices = influenced_invoices - sourced_invoices |
#influence_only_revenue ⇒ BigDecimal
Revenue the campaign touched but did NOT acquire. The honest "we helped"
number, once the deals it already gets first-touch credit for are out.
69 |
# File 'app/queries/marketing/campaign_influence.rb', line 69 def influence_only_revenue = influenced_revenue - sourced_revenue |