lib/split/experiment.rb in split-0.3.3 vs lib/split/experiment.rb in split-0.4.0
- old
+ new
@@ -24,15 +24,19 @@
def reset_winner
Split.redis.hdel(:experiment_winner, name)
end
-
def winner=(winner_name)
Split.redis.hset(:experiment_winner, name, winner_name.to_s)
end
+ def start_time
+ t = Split.redis.hget(:experiment_start_times, @name)
+ Time.parse(t) if t
+ end
+
def alternatives
@alternatives.dup
end
def alternative_names
@@ -90,9 +94,10 @@
end
def save
if new_record?
Split.redis.sadd(:experiments, name)
+ Split.redis.hset(:experiment_start_times, @name, Time.now)
@alternatives.reverse.each {|a| Split.redis.lpush(name, a.name) }
end
end
def self.load_alternatives_for(name)
\ No newline at end of file