This change introduces several things things: 1. Fixes the performance of the `/admin/abtests` page; instead of rendering all of the experiment results, just render the overview. 2. Adjust the show page for an experiment to show the summary of results. 3. Favor the existing "started_at" and "ended_at" attributes of FieldTest (see https://github.com/ankane/field_test#config) 4. Update the field test experiments to include the `started_at` and `ended_at` attributes. 5. Skip processing all non-active experiments in our conversion handler. Why are there no tests? This is a page that is Admin only and is only visible for reporting purposes. So, it's not quite worth writing tests as you'd need lots of data. So we'll assume the logic from the upstream [field_test gem][1] is adequate. Closes forem/forem#17869 [1]:https://github.com/ankane/field_test
16 lines
559 B
Ruby
16 lines
559 B
Ruby
# This controller originally came from
|
|
# https://github.com/ankane/field_test/blob/master/app/controllers/field_test/experiments_controller.rb
|
|
module FieldTest
|
|
class ExperimentsController < BaseController
|
|
def index
|
|
# More recently started experiments at the top
|
|
@experiments = FieldTest::Experiment.all.sort_by(&:started_at).reverse
|
|
end
|
|
|
|
def show
|
|
@experiment = FieldTest::Experiment.find(params[:id])
|
|
rescue FieldTest::ExperimentNotFound
|
|
raise ActionController::RoutingError, "Experiment not found"
|
|
end
|
|
end
|
|
end
|