Every campaign has an end.

Drop ahoy, because it's more trouble than it's worth. This means dropping
visits, campaigns, targets.

Campaigns are better run to analytics, such as:
* https://matomo.org/docs/tracking-campaigns/
* https://matomo.org/docs/tracking-goals-web-analytics/
* https://support.google.com/analytics/answer/1012040?hl=en
This commit is contained in:
James Mason 2018-10-08 17:58:41 -07:00 committed by Henne Vogelsang
parent 62056fc044
commit b11001cdba
47 changed files with 19 additions and 1420 deletions

View file

@ -45,8 +45,6 @@ class Conference < ApplicationRecord
has_many :vpositions, dependent: :destroy
has_many :sponsorship_levels, -> { order('position ASC') }, dependent: :destroy
has_many :sponsors, dependent: :destroy
has_many :targets, dependent: :destroy
has_many :campaigns, dependent: :destroy
has_many :commercials, as: :commercialable, dependent: :destroy
has_many :subscriptions, dependent: :destroy
has_one :call_for_events, -> { where(cfp_type: 'events') }, through: :program, source: :cfps
@ -76,8 +74,6 @@ class Conference < ApplicationRecord
accepts_nested_attributes_for :questions, allow_destroy: true
accepts_nested_attributes_for :vdays, allow_destroy: true
accepts_nested_attributes_for :vpositions, allow_destroy: true
accepts_nested_attributes_for :targets, allow_destroy: true
accepts_nested_attributes_for :campaigns, allow_destroy: true
mount_uploader :picture, PictureUploader, mount_on: :logo_file_name
@ -640,35 +636,6 @@ class Conference < ApplicationRecord
]
end
##
# A map with all conference targets with progress in percent of a certain unit.
#
# ====Returns
# * +Map+ -> target => progress
def get_targets(target_unit)
conference_target = targets.where('unit = ?', target_unit)
result = {}
conference_target.each do |target|
result[target.to_s] = target.get_progress
end
result
end
##
# A map with all conference campaigns associated with targets.
#
# ====Returns
# * +Map+ -> campaign => {actual, target, progress}
def get_campaigns
result = {}
campaigns.each do |campaign|
campaign.targets.each do |target|
result["#{target} from #{campaign.name}"] = target.get_campaign
end
end
result
end
##
# Writes an snapshot of the actual event distribution to the database
# Triggered each every Sunday 11:55 pm form whenever (config/schedule.rb).