Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions lib/split/dashboard.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ class Dashboard < Sinatra::Base
helpers Split::DashboardHelpers

get '/' do
@experiments = Split::Experiment.all
# Display experiments without a winner at the top of the dashboard
@experiments = Split::Experiment.all_active_first
# Display Rails Environment mode (or Rack version if not using Rails)
if Object.const_defined?('Rails')
@current_env = Rails.env.titlecase
Expand Down Expand Up @@ -44,4 +45,4 @@ class Dashboard < Sinatra::Base
redirect url('/')
end
end
end
end
5 changes: 5 additions & 0 deletions lib/split/experiment.rb
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,11 @@ def self.all
Split.redis.smembers(:experiments).map {|e| find(e)}
end

# Return experiments without a winner (considered "active") first
def self.all_active_first
all.sort_by{|e| e.winner ? 1 : 0} # sort_by hack since true/false isn't sortable
end

def self.find(name)
if Split.redis.exists(name)
obj = self.new name
Expand Down