File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ class Alternative
66 attr_accessor :experiment_name
77 attr_accessor :weight
88 attr_accessor :recorded_info
9+ attr_writer :experiment
910
1011 def initialize ( name , experiment_name )
1112 @experiment_name = experiment_name
@@ -100,7 +101,7 @@ def conversion_rate(goal = nil)
100101 end
101102
102103 def experiment
103- Split ::ExperimentCatalog . find ( experiment_name )
104+ @experiment ||= Split ::ExperimentCatalog . find ( experiment_name )
104105 end
105106
106107 def z_score ( goal = nil )
Original file line number Diff line number Diff line change @@ -57,7 +57,7 @@ def set_alternatives_and_options(options)
5757 )
5858
5959 self . alternatives = options_with_defaults [ :alternatives ]
60- self . goals = options_with_defaults [ :goals ]
60+ self . goals = options_with_defaults [ :goals ] || [ ]
6161 self . resettable = options_with_defaults [ :resettable ]
6262 self . algorithm = options_with_defaults [ :algorithm ]
6363 self . metadata = options_with_defaults [ :metadata ]
@@ -145,6 +145,7 @@ def alternatives=(alts)
145145 Split ::Alternative . new ( alternative , @name )
146146 end
147147 end
148+ @alternatives . each { |alternative | alternative . experiment = self }
148149 end
149150
150151 def winner
You can’t perform that action at this time.
0 commit comments