app/controllers/teams_controller.rb
# Radiography for a specified team id: "Goggle cup all of fame" tab rendering
# Shows the first three swuimmer of closed edition of Goggle cup
#
# == Params:
# id: the team id to be processed
#
Radiography for a specified team id: "Goggle cup all of fame" tab rendering
Shows the first three swuimmer of closed edition of Goggle cup

the team id to be processed
Radiography for a specified team id : " Goggle cup all of fame " tab rendering Shows the first three swuimmer of closed edition of Goggle cup the team id to be processed
def goggle_cup_all_of_fame
    @tab_title = I18n.t('radiography.goggle_cup_all_of_fame_tab')
    @closed_goggle_cup = []
    @team.goggle_cups.each do |goggle_cup|
      if goggle_cup.is_closed_at?
        goggle_cup_rank = goggle_cup.calculate_goggle_cup_rank
        @closed_goggle_cup << {
          goggle_cup:    goggle_cup,
          year:          goggle_cup.season_year,
          first:         goggle_cup_rank[0] ? goggle_cup_rank[0][:swimmer] : nil,
          first_points:  goggle_cup_rank[0] ? goggle_cup_rank[0][:total]   : 0,
          second:        goggle_cup_rank[1] ? goggle_cup_rank[1][:swimmer] : nil,
          second_points: goggle_cup_rank[1] ? goggle_cup_rank[1][:total]   : 0,
          third:         goggle_cup_rank[2] ? goggle_cup_rank[2][:swimmer] : nil,
          third_points:  goggle_cup_rank[2] ? goggle_cup_rank[2][:total]   : 0
        } if goggle_cup_rank.size > 0
      end
      @closed_goggle_cup.sort!{ |hash_element_prev, hash_element_next| hash_element_next[:year] <=> hash_element_prev[:year] }
    end
  end
def goggle_cup_all_of_fame @tab_title = I18n . t ( 'radiography.goggle_cup_all_of_fame_tab' ) @closed_goggle_cup = [ ] @team . goggle_cups . each do | goggle_cup | if goggle_cup . is_closed_at? goggle_cup_rank = goggle_cup . calculate_goggle_cup_rank @closed_goggle_cup << { goggle_cup : goggle_cup , year : goggle_cup . season_year , first : goggle_cup_rank [ 0 ] ? goggle_cup_rank [ 0 ] [ :swimmer ] : nil , first_points : goggle_cup_rank [ 0 ] ? goggle_cup_rank [ 0 ] [ :total ] : 0 , second : goggle_cup_rank [ 1 ] ? goggle_cup_rank [ 1 ] [ :swimmer ] : nil , second_points : goggle_cup_rank [ 1 ] ? goggle_cup_rank [ 1 ] [ :total ] : 0 , third : goggle_cup_rank [ 2 ] ? goggle_cup_rank [ 2 ] [ :swimmer ] : nil , third_points : goggle_cup_rank [ 2 ] ? goggle_cup_rank [ 2 ] [ :total ] : 0 } if goggle_cup_rank . size > 0 end @closed_goggle_cup . sort! { | hash_element_prev , hash_element_next | hash_element_next [ :year ] <=> hash_element_prev [ :year ] } end end
Radiography for a specified team id: "Goggle cup all of fame" tab rendering
Shows the first three swuimmer of closed edition of Goggle cup
Radiography for a specified team id : " Goggle cup all of fame " tab rendering Shows the first three swuimmer of closed edition of Goggle cup
# Prepares an hash to store closed goggle cup rank # Gets closed, valid goggle cup, if any # Collects first three positions of that closed goggle cup # Adds goggle cup data to the hash # Sorts the array  by the year