diff --git a/lib/split/dashboard/public/dashboard-filtering.js b/lib/split/dashboard/public/dashboard-filtering.js index f58fe623..9383366c 100644 --- a/lib/split/dashboard/public/dashboard-filtering.js +++ b/lib/split/dashboard/public/dashboard-filtering.js @@ -2,7 +2,7 @@ $(function() { $('#filter').on('keyup', function() { $input = $(this); - if ($input.val() == '') { + if ($input.val() === '') { $('div.experiment').show(); return false; } @@ -21,7 +21,7 @@ $(function() { $('#toggle-active').on('click', function() { $button = $(this); - if ($button.val() == 'Hide active') { + if ($button.val() === 'Hide active') { $button.val('Show active'); } else { $button.val('Hide active'); @@ -32,7 +32,7 @@ $(function() { $('#toggle-completed').on('click', function() { $button = $(this); - if ($button.val() == 'Hide completed') { + if ($button.val() === 'Hide completed') { $button.val('Show completed'); } else { $button.val('Hide completed'); diff --git a/lib/split/experiment.rb b/lib/split/experiment.rb index 770b12dc..6eeaa587 100644 --- a/lib/split/experiment.rb +++ b/lib/split/experiment.rb @@ -135,8 +135,9 @@ def alternatives=(alts) end def winner - if w = redis.hget(:experiment_winner, name) - Split::Alternative.new(w, name) + experiment_winner = redis.hget(:experiment_winner, name) + if experiment_winner + Split::Alternative.new(experiment_winner, name) else nil end @@ -171,9 +172,9 @@ def start_time if t # Check if stored time is an integer if t =~ /^[-+]?[0-9]+$/ - t = Time.at(t.to_i) + Time.at(t.to_i) else - t = Time.parse(t) + Time.parse(t) end end end @@ -191,7 +192,7 @@ def random_alternative end def version - @version ||= (redis.get("#{name.to_s}:version").to_i || 0) + @version ||= (redis.get("#{name}:version").to_i || 0) end def increment_version @@ -280,8 +281,6 @@ def calc_winning_alternatives end def estimate_winning_alternative(goal = nil) - # TODO - refactor out functionality to work with and without goals - # initialize a hash of beta distributions based on the alternatives' conversion rates beta_params = calc_beta_params(goal) @@ -401,7 +400,7 @@ def experiment_config_key end def load_metadata_from_configuration - metadata = Split.configuration.experiment_for(@name)[:metadata] + Split.configuration.experiment_for(@name)[:metadata] end def load_metadata_from_redis