Class: Mg::Test

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
lib/mountain-goat/models/mg/test.rb

Overview

Mg::Test represents something you are ‘a/b testing’

Attributes

test_type

Symbol uniquely identifying this test (for code interaction)

title

Title of the test (E.g. Banner text)

tally_each_serve

Should we count each view by a user as a hit, or just first-serve to that user?

is_switch

Are we implementing a code-switch as opposed to a text substitution

deleted_at

Is this test deleted? (MG Console)

is_hidden

Is this test hidden? (MG Console)

Instance Method Summary collapse

Instance Method Details

#total_rewardObject

Get total reward of all choices for this test



23
24
25
# File 'lib/mountain-goat/models/mg/test.rb', line 23

def total_reward
  self.mg_choices.map { |choice| choice.reward || 0 }.sum
end

#total_servedObject

Get total served of all choices for this test



28
29
30
# File 'lib/mountain-goat/models/mg/test.rb', line 28

def total_served
  self.mg_choices.map { |choice| choice.served || 0 }.sum
end