Sha256: 4a77de636869e0363f7da26593f0790f711dd020e3e1d904dd41b801501b5f19
Contents?: true
Size: 842 Bytes
Versions: 18
Compression:
Stored size: 842 Bytes
Contents
module FieldTest class ExperimentsController < BaseController def index @active_experiments, @completed_experiments = FieldTest::Experiment.all.sort_by(&:id).partition { |e| e.active? } end def show @experiment = FieldTest::Experiment.find(params[:id]) @per_page = 200 @page = [1, params[:page].to_i].max offset = (@page - 1) * @per_page @memberships = @experiment.memberships.order(created_at: :desc).limit(@per_page).offset(offset).to_a @events = if FieldTest.events_supported? @experiment.events.where(field_test_membership_id: @memberships.map(&:id)).group(:field_test_membership_id, :name).count else {} end rescue FieldTest::ExperimentNotFound raise ActionController::RoutingError, "Experiment not found" end end end
Version data entries
18 entries across 18 versions & 1 rubygems