Class: CampaignProduction

Inherits:
Object
  • Object
show all
Defined in:
app/models/campaign_production.rb

Overview

A CampaignProduction is a the same as an ActivityProduction for annual production but it represents the “year” of campaign or perennial productions.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(campaign, activity_production) ⇒ CampaignProduction

Returns a new instance of CampaignProduction.


14
15
16
17
# File 'app/models/campaign_production.rb', line 14

def initialize(campaign, activity_production)
  @campaign = campaign
  @activity_production = activity_production
end

Instance Attribute Details

#activity_productionObject (readonly)

Returns the value of attribute activity_production


4
5
6
# File 'app/models/campaign_production.rb', line 4

def activity_production
  @activity_production
end

#campaignObject (readonly)

Returns the value of attribute campaign


4
5
6
# File 'app/models/campaign_production.rb', line 4

def campaign
  @campaign
end

Class Method Details

.of(campaign) ⇒ Object


8
9
10
11
12
# File 'app/models/campaign_production.rb', line 8

def self.of(campaign)
  campaign.activity_productions.map do |p|
    new(campaign, p)
  end
end

Instance Method Details

#cost_amountObject

Compute cost amount in global currency for the current campaign production Cost is the sum of all


29
# File 'app/models/campaign_production.rb', line 29

def cost_amount; end

#started_onObject


19
20
21
# File 'app/models/campaign_production.rb', line 19

def started_on
  @started_on ||= @activity_production.started_on_for(@campaign)
end

#stopped_onObject


23
24
25
# File 'app/models/campaign_production.rb', line 23

def stopped_on
  @stopped_on ||= @activity_production.stopped_on_for(@campaign)
end