app/models/player.rb
# Trims the list to the highest title for each
# season if more than one earned in a season
Trims the list to the highest title for each
season if more than one earned in a season
Trims the list to the highest title for each season if more than one earned in a season
def trim_titles titles
    h = Hash.new
    titles.each do |title|
      if h.include? title.season
        h[title.season] = title if title > h[title.season]
      else
        h[title.season] = title
      end
    end
    time_sorted = h.values.sort {|a, b| b.date <=> a.date}
    return cleanup_r1 time_sorted
  end
def trim_titles titles h = Hash . new titles . each do | title | if h . include? title . season h [ title . season ] = title if title > h [ title . season ] else h [ title . season ] = title end end time_sorted = h . values . sort { | a , b | b . date <=> a . date } return cleanup_r1 time_sorted end
Trims the list to the highest title for each
season if more than one earned in a season
Trims the list to the highest title for each season if more than one earned in a season
titles
<not_specific>