Module: Laboratory::UIHelpers
- Defined in:
- lib/laboratory/ui/helpers.rb
Instance Method Summary collapse
- #analysis_summary(experiment, event_id) ⇒ Object
- #assign_users_to_variant_url(experiment) ⇒ Object
- #experiment_url(experiment) ⇒ Object
- #path_prefix ⇒ Object
- #reset_experiment_url(experiment) ⇒ Object
- #update_percentages_url(experiment) ⇒ Object
- #url(*path_parts) ⇒ Object
Instance Method Details
#analysis_summary(experiment, event_id) ⇒ Object
27 28 29 30 31 32 33 34 35 36 37 |
# 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) ⇒ Object
19 20 21 |
# 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) ⇒ Object
11 12 13 |
# File 'lib/laboratory/ui/helpers.rb', line 11 def experiment_url(experiment) url('experiments', CGI.escape(experiment.id), 'edit') end |
#path_prefix ⇒ Object
7 8 9 |
# File 'lib/laboratory/ui/helpers.rb', line 7 def path_prefix request.env['SCRIPT_NAME'] end |
#reset_experiment_url(experiment) ⇒ Object
23 24 25 |
# 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) ⇒ Object
15 16 17 |
# 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) ⇒ Object
3 4 5 |
# File 'lib/laboratory/ui/helpers.rb', line 3 def url(*path_parts) [path_prefix, path_parts].join('/').squeeze('/') end |