app/controllers/swimmers_controller.rb
# Radiography for a specified swimmer id: "Supermaster" tab rendering.
# Show FIN supermaster results and main rankings
# Main rankings are:
# - Supermaster  -> Best different event types 5 results
# - Ironmaster   -> All event types best results (one per type)
# - Team ranking -> Best different event types 3 results with at least 3 meetings
#
# == 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: "Supermaster" tab rendering.
Show FIN supermaster results and main rankings
Main rankings are:
Supermaster  -> Best different event types 5 results
Ironmaster   -> All event types best results (one per type)
Team ranking -> Best different event types 3 results with at least 3 meetings

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 : " Supermaster " tab rendering . Show FIN supermaster results and main rankings Main rankings are : Supermaster - > Best different event types 5 results Ironmaster - > All event types best results ( one per type ) Team ranking - > Best different event types 3 results with at least 3 meetings 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 supermaster
    @tab_title   = I18n.t('supermaster.supermaster')
    @season_type = SeasonType.find_by_code('MASFIN')
    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: root_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
    @meetings = @badge.meetings.sort_by_date.distinct
    @sssc = SwimmerSeasonalScoreCalculator.new( @swimmer, @season )
    @meeting_individual_results = @sssc.get_results
  end
def supermaster @tab_title = I18n . t ( 'supermaster.supermaster' ) @season_type = SeasonType . find_by_code ( 'MASFIN' ) 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 : root_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 @meetings = @badge . meetings . sort_by_date . distinct @sssc = SwimmerSeasonalScoreCalculator . new ( @swimmer , @season ) @meeting_individual_results = @sssc . get_results end
Radiography for a specified swimmer id: "Supermaster" tab rendering.
Radiography for a specified swimmer id : " Supermaster " tab rendering .
# --- "Supermaster" tab: --- # (No unsafe params can be passed) #flash[:error] = I18n.t('swimmers.no_associated_badge_found') # Check for overrides