Skip to content

Instantly share code, notes, and snippets.

@bernsno
Forked from dougalcorn/gist:163071
Created August 6, 2009 01:05
Show Gist options
  • Save bernsno/163075 to your computer and use it in GitHub Desktop.
Save bernsno/163075 to your computer and use it in GitHub Desktop.
rec_td_stat_name = StatName.find_by_title("Reception Touchdowns")
rush_td_stat_name = StatName.find_by_title("Rush Touchdowns")
rrtd_stat_name = StatName.find_by_title("Rushing and Receiving Touchdowns")
CareerStat.find_all_by_stat_name_id(rrtd_stat_name.id).each do |career_stat|
rec_td_career_stat = CareerStat.find_by_season_id_and_player_id_and_stat_name_id(career_stat.season_id, career_stat.player_id, rec_td_stat_name.id)
rush_td_career_stat = CareerStat.find_by_season_id_and_player_id_and_stat_name_id(career_stat.season_id, career_stat.player_id, rush_td_stat_name.id)
career_stat.update_attributes!(:value => rec_td_career_stat.value.to_i + rush_td_career_stat.value.to_i)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment