Class: FieldTest::ParticipantsController

Inherits:
BaseController
  • Object
show all
Defined in:
app/controllers/field_test/participants_controller.rb

Instance Method Summary collapse

Instance Method Details

#showObject



3
4
5
6
7
8
9
10
11
12
13
14
# File 'app/controllers/field_test/participants_controller.rb', line 3

def show
  @participant = params[:id]
  # TODO better ordering
  @memberships = FieldTest::Membership.where(participant: @participant).order(:id)

  @events =
    if FieldTest.events_supported?
      FieldTest::Event.where(field_test_membership_id: @memberships.map(&:id)).group(:field_test_membership_id, :name).count
    else
      {}
    end
end