mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-25 01:14:43 +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
|
||||
@@ -10,7 +10,7 @@
|
||||
#
|
||||
# It's strongly recommended that you check this file into your version control system.
|
||||
|
||||
ActiveRecord::Schema.define(version: 2018_09_17_133030) do
|
||||
ActiveRecord::Schema.define(version: 2019_04_19_142230) do
|
||||
|
||||
create_table "delayed_jobs", force: :cascade do |t|
|
||||
t.integer "priority", default: 0, null: false
|
||||
@@ -146,6 +146,8 @@ ActiveRecord::Schema.define(version: 2018_09_17_133030) do
|
||||
t.boolean "extra"
|
||||
t.decimal "offical_weight"
|
||||
t.integer "pool"
|
||||
t.integer "pool_placement"
|
||||
t.string "pool_placement_tiebreaker"
|
||||
t.index ["weight_id"], name: "index_wrestlers_on_weight_id"
|
||||
end
|
||||
|
||||
|
||||
Reference in New Issue
Block a user