1
0
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:
2019-04-19 10:33:06 -04:00
parent 31fbe5baff
commit a76f4036b3
15 changed files with 766 additions and 585 deletions

View File

@@ -0,0 +1,5 @@
class AddPoolPlacementToWrestler < ActiveRecord::Migration[5.2]
def change
add_column :wrestlers, :pool_placement, :integer
end
end

View File

@@ -0,0 +1,5 @@
class AddPoolPlacementTiebreakerToWrestler < ActiveRecord::Migration[5.2]
def change
add_column :wrestlers, :pool_placement_tiebreaker, :string
end
end

View File

@@ -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

View File

@@ -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