porkchopclub/porkchop

View on GitHub
db/migrate/20150303081428_adjust_player_ratings.rb

Summary

Maintainability
A
0 mins
Test Coverage
class AdjustPlayerRatings < ActiveRecord::Migration
  def up
    Match.finalized.order(finalized_at: :asc).find_each do |match|
      EloAdjustment.new(victor: match.victor,
                        loser: match.loser).adjust!
    end
  end

  def down
    Player.update_all elo: 1000
  end
end