mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-04 13:43:48 +00:00
Added persistence to pool placement and pool order
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
class AddPoolPlacementToWrestler < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :wrestlers, :pool_placement, :integer
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,5 @@
|
||||
class AddPoolPlacementTiebreakerToWrestler < ActiveRecord::Migration[5.2]
|
||||
def change
|
||||
add_column :wrestlers, :pool_placement_tiebreaker, :string
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,17 @@
|
||||
class SetPoolPlacementForExistingTournaments < ActiveRecord::Migration[5.2]
|
||||
|
||||
def change
|
||||
|
||||
Tournament.all.each do | tournament |
|
||||
tournament.weights.each do | weight |
|
||||
for pool in (1..weight.pools) do
|
||||
if weight.all_pool_matches_finished(pool)
|
||||
PoolOrder.new(weight.wrestlers_in_pool(pool)).getPoolOrder
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
Reference in New Issue
Block a user