module Laboratory::UIHelpers

Public Instance Methods

analysis_summary(experiment, event_id) click to toggle source
# File lib/laboratory/ui/helpers.rb, line 27
def analysis_summary(experiment, event_id)
  return if experiment.variants.length < 2

  analysis = experiment.analysis_summary_for(event_id)

  "#{analysis.highest_performing_variant.id} is performing" \
  " #{analysis.performance_delta_between_highest_and_lowest * 100}%" \
  " better than #{analysis.lowest_performing_variant.id}. I'm" \
  " #{analysis.confidence_level_in_performance_delta * 100}% certain of" \
  ' this.'
end
assign_users_to_variant_url(experiment) click to toggle source
# File lib/laboratory/ui/helpers.rb, line 19
def assign_users_to_variant_url(experiment)
  url('experiments', CGI.escape(experiment.id), 'assign_users')
end
experiment_url(experiment) click to toggle source
# File lib/laboratory/ui/helpers.rb, line 11
def experiment_url(experiment)
  url('experiments', CGI.escape(experiment.id), 'edit')
end
path_prefix() click to toggle source
# File lib/laboratory/ui/helpers.rb, line 7
def path_prefix
  request.env['SCRIPT_NAME']
end
reset_experiment_url(experiment) click to toggle source
# File lib/laboratory/ui/helpers.rb, line 23
def reset_experiment_url(experiment)
  url('experiments', CGI.escape(experiment.id), 'reset')
end
update_percentages_url(experiment) click to toggle source
# File lib/laboratory/ui/helpers.rb, line 15
def update_percentages_url(experiment)
  url('experiments', CGI.escape(experiment.id), 'update_percentages')
end
url(*path_parts) click to toggle source
# File lib/laboratory/ui/helpers.rb, line 3
def url(*path_parts)
  [path_prefix, path_parts].join('/').squeeze('/')
end