app/strategies/calendar_meeting_picker.rb
# Pick meetings by team
# Meetings are those attended by parameter team
#
Pick meetings by team
Meetings are those attended by parameter team
Pick meetings by team Meetings are those attended by parameter team
def pick_meetings_by_team( order = 'ASC', show_cancelled = true, current_user = nil )
    team_id = @parameters[:team_id]
    meetings_count = 0
    if team_id && team_id > 0
      filters = "(meeting_individual_results.team_id = #{team_id})" 
      filters += ' AND (NOT is_cancelled)' if !show_cancelled
      Meeting
        .joins(:meeting_individual_results)
        .includes(meeting_sessions: [swimming_pool: [:city, :pool_type], meeting_events: [event_type: [:stroke_type]]], season: [:season_type])
        .where( "#{filters}" )
        .distinct
        .order( "meetings.header_date #{order}" )
        .each do |meeting|
          team_affiliation_id = nil
          team_affiliation_id = @manageable_seasons[meeting.season_id] if @manageable_seasons && @manageable_seasons.size > 0 
          can_manage = !team_affiliation_id.nil?
          team_affiliation_id = @swimmer_badges[meeting.season_id] if team_affiliation_id.nil? && @swimmer_badges && @swimmer_badges.size > 0 
          is_user_tagged = @user_tagged_meetings.include?(meeting.id)
          is_team_tagged = @team_tagged_meetings.include?(meeting.id)
          @calendarDAO.add_meeting( meeting, current_user, can_manage, team_affiliation_id, is_user_tagged, is_team_tagged )
          meetings_count += 1 
        end
    end
    meetings_count
  end
def pick_meetings_by_team ( order = 'ASC' , show_cancelled = true , current_user = nil ) team_id = @parameters [ :team_id ] meetings_count = 0 if team_id && team_id > 0 filters = "(meeting_individual_results.team_id = #{team_id})" filters += ' AND (NOT is_cancelled)' if ! show_cancelled Meeting . joins ( :meeting_individual_results ) . includes ( meeting_sessions : [ swimming_pool : [ :city , :pool_type ] , meeting_events : [ event_type : [ :stroke_type ] ] ] , season : [ :season_type ] ) . where ( "#{filters}" ) . distinct . order ( "meetings.header_date #{order}" ) . each do | meeting | team_affiliation_id = nil team_affiliation_id = @manageable_seasons [ meeting . season_id ] if @manageable_seasons && @manageable_seasons . size > 0 can_manage = ! team_affiliation_id . nil? team_affiliation_id = @swimmer_badges [ meeting . season_id ] if team_affiliation_id . nil? && @swimmer_badges && @swimmer_badges . size > 0 is_user_tagged = @user_tagged_meetings . include? ( meeting . id ) is_team_tagged = @team_tagged_meetings . include? ( meeting . id ) @calendarDAO . add_meeting ( meeting , current_user , can_manage , team_affiliation_id , is_user_tagged , is_team_tagged ) meetings_count += 1 end end meetings_count end
Pick meetings by team
Meetings are those attended by parameter team
Pick meetings by team Meetings are those attended by parameter team
# Create filter # Verify managements
order
<not_specific>
show_cancelled
<not_specific>
current_user
<not_specific>