app/controllers/meeting_reservations_controller.rb
# Collects the list of @reservations_events associated to the specified meeting
# and team_affiliation.
#
# Assumes @meeting_reservations is already filled with a list of MeetingReservation rows.
#
# === Params:
# - meeting: a valid instance of Meeting
# - team_affiliation: a valid instance of TeamAffiliation (capable of attending the Meeting)
#
# === Prepares:
# - @reservations_events: Hash with the structure { <MeetingReservation.id> => <MeetingEventReservation row> }
#
Collects the list of @reservations_events associated to the specified meeting
and team_affiliation.

Assumes @meeting_reservations is already filled with a list of MeetingReservation rows.

a valid instance of Meeting
team_affiliation: a valid instance of TeamAffiliation (capable of attending the Meeting)

@reservations_events: Hash with the structure {  =>  }
Collects the list of @reservations_events associated to the specified meeting and team_affiliation . Assumes @meeting_reservations is already filled with a list of MeetingReservation rows . a valid instance of Meeting team_affiliation : a valid instance of TeamAffiliation ( capable of attending the Meeting ) @reservations_events : Hash with the structure { = > }
def prepare_events_reservations( meeting, team_affiliation )
    @reservations_events = {}
    @meeting_reservations.each do |reservation|
      @reservations_events[ reservation.id ] = MeetingEventReservation.where(
          meeting_id: meeting.id,
          team_id: team_affiliation.team_id,
          swimmer_id: reservation.swimmer_id
      ).joins(meeting_event: [:meeting_session, :event_type])
        .includes(meeting_event: [:meeting_session, :event_type])
        .order('meeting_sessions.session_order, meeting_events.event_order')
        .to_a
    end
  end
def prepare_events_reservations ( meeting , team_affiliation ) @reservations_events = { } @meeting_reservations . each do | reservation | @reservations_events [ reservation . id ] = MeetingEventReservation . where ( meeting_id : meeting . id , team_id : team_affiliation . team_id , swimmer_id : reservation . swimmer_id ) . joins ( meeting_event : [ :meeting_session , :event_type ] ) . includes ( meeting_event : [ :meeting_session , :event_type ] ) . order ( 'meeting_sessions.session_order, meeting_events.event_order' ) . to_a end end
Collects the list of @reservations_events associated to the specified meeting
and team_affiliation.
Collects the list of @reservations_events associated to the specified meeting and team_affiliation .
# Get the list of rows of event reservations for each athlete: # Assuming 'mer' is an item of the resulting array, this yields something # like: #       mer.event_type.i18n_short             for the event description #       mer.meeting_session.scheduled_date    for the scheduled date
meeting
<not_specific>
team_affiliation
<not_specific>