Skip to content

Instantly share code, notes, and snippets.

@dougalcorn
Forked from bernsno/gist:163069
Created August 6, 2009 00:55
Show Gist options
  • Save dougalcorn/163071 to your computer and use it in GitHub Desktop.
Save dougalcorn/163071 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")
GameStat.find_all_by_stat_name_id(rrtd_stat_name.id).each do |game_stat|
rec_td_game_stat = GameState.find_by_game_id_and_player_id_and_stat_name_id(game_stat.game_id, game_stat.player_id, rec_td_stat_name.id)
rush_td_game_stat = GameState.find_by_game_id_and_player_id_and_stat_name_id(game_stat.game_id, game_stat.player_id, rush_td_stat_name.id)
game_stat.update_attributes(:value => rec_td_game_stat.value.to_i + rush_td_game_stat.value.to_i)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment