lib/split/trial.rb in split-3.3.0 vs lib/split/trial.rb in split-3.3.1
- old
+ new
@@ -66,24 +66,22 @@
cleanup_old_versions
if exclude_user?
self.alternative = @experiment.control
else
- value = @user[@experiment.key]
- if value
- self.alternative = value
- else
+ self.alternative = @user[@experiment.key]
+ if alternative.nil?
self.alternative = @experiment.next_alternative
# Increment the number of participants since we are actually choosing a new alternative
self.alternative.increment_participation
run_callback context, Split.configuration.on_trial_choose
end
end
end
- @user[@experiment.key] = alternative.name if should_store_alternative?
+ @user[@experiment.key] = alternative.name if !@experiment.has_winner? && should_store_alternative?
@alternative_choosen = true
run_callback context, Split.configuration.on_trial unless @options[:disabled] || Split.configuration.disabled?
alternative
end