app/controllers/swimmers_controller.rb
# Radiography for a specified swimmer id: "Regional ER CSI" tab rendering.
# Show regional Emilia Romagna CSI results stats and explanation
#
# == Params:
# id: the swimmer id to be processed
#
# header_year: typically nil, it's a current date override for when checking
#      for @swimmer badges in current season (mainly used only inside specs
#      to test a couple of edge conditions)
#
Radiography for a specified swimmer id: "Regional ER CSI" tab rendering.
Show regional Emilia Romagna CSI results stats and explanation

the swimmer id to be processed

typically nil, it's a current date override for when checking
for @swimmer badges in current season (mainly used only inside specs
to test a couple of edge conditions)
Radiography for a specified swimmer id : " Regional ER CSI " tab rendering . Show regional Emilia Romagna CSI results stats and explanation the swimmer id to be processed typically nil it ' s a current date override for when checking for @swimmer badges in current season ( mainly used only inside specs to test a couple of edge conditions )
def regionalercsi
    @tab_title   = I18n.t('regionalercsi.title')
    @season_type = SeasonType.find_by_code('MASCSI')
    params.permit! 
    @header_year = params['header_year'].nil? ? Season.build_header_year_from_date : params['header_year'].to_i
    @badge       = @swimmer.badges.for_season_type( @season_type ).for_year( @header_year ).first
    if @badge.nil?
      @errore = I18n.t('swimmers.no_associated_badge_found')
      @badge = @swimmer.badges.for_season_type( @season_type ).sort_by_season('DESC').first
      @header_year = @badge.season.header_year
      if @badge.nil?
        redirect_back( fallback_location: swimmer_radio_path ) and return
      end
    end
    @season           = @badge.season
    @team             = @badge.team
    @team_affiliation = if params['header_year'].present?
      @team.team_affiliations.for_season_type( @season_type ).for_year( @header_year ).first
    else
      @team.get_current_affiliation( @season_type )
    end
    @swimmer_score = EnhanceIndividualRankingDAO::EIRSwimmerScoreDAO.new( @swimmer, @season )
    @events_list = []
    EventsByPoolType.not_relays.for_pool_type_code( '25' ).distance_more_than(50).distance_less_than(800).sort_by_event.each do |events_by_pool_type|
      @events_list << events_by_pool_type.event_type
    end
    @events_list = @events_list.delete_if{|e| e.code == '200FA' || e.code == '200RA' || e.code == '200DO' || e.code == '400MI' }
  end
def regionalercsi @tab_title = I18n . t ( 'regionalercsi.title' ) @season_type = SeasonType . find_by_code ( 'MASCSI' ) params . permit! @header_year = params [ 'header_year' ] . nil? ? Season . build_header_year_from_date : params [ 'header_year' ] . to_i @badge = @swimmer . badges . for_season_type ( @season_type ) . for_year ( @header_year ) . first if @badge . nil? @errore = I18n . t ( 'swimmers.no_associated_badge_found' ) @badge = @swimmer . badges . for_season_type ( @season_type ) . sort_by_season ( 'DESC' ) . first @header_year = @badge . season . header_year if @badge . nil? redirect_back ( fallback_location : swimmer_radio_path ) and return end end @season = @badge . season @team = @badge . team @team_affiliation = if params [ 'header_year' ] . present? @team . team_affiliations . for_season_type ( @season_type ) . for_year ( @header_year ) . first else @team . get_current_affiliation ( @season_type ) end @swimmer_score = EnhanceIndividualRankingDAO :: EIRSwimmerScoreDAO . new ( @swimmer , @season ) @events_list = [ ] EventsByPoolType . not_relays . for_pool_type_code ( '25' ) . distance_more_than ( 50 ) . distance_less_than ( 800 ) . sort_by_event . each do | events_by_pool_type | @events_list << events_by_pool_type . event_type end @events_list = @events_list . delete_if { | e | e . code == '200FA' || e . code == '200RA' || e . code == '200DO' || e . code == '400MI' } end
Radiography for a specified swimmer id: "Regional ER CSI" tab rendering.
Radiography for a specified swimmer id : " Regional ER CSI " tab rendering .
# --- "Regional ER CSI" tab: --- # (No unsafe params can be passed) #flash[:error] = I18n.t('swimmers.no_associated_badge_found') # Check for overrides # Creates managed event list