mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-28 18:04:55 +00:00
Show no matches while matches are being generated
This commit is contained in:
@@ -144,7 +144,7 @@ class TournamentsController < ApplicationController
|
|||||||
|
|
||||||
def check_for_matches
|
def check_for_matches
|
||||||
if @tournament
|
if @tournament
|
||||||
if @tournament.matches.empty?
|
if @tournament.matches.empty? or @tournament.curently_generating_matches == 1
|
||||||
redirect_to "/tournaments/#{@tournament.id}/no_matches"
|
redirect_to "/tournaments/#{@tournament.id}/no_matches"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
module GeneratesTournamentMatches
|
module GeneratesTournamentMatches
|
||||||
|
|
||||||
def generateMatchups
|
def generateMatchups
|
||||||
|
self.curently_generating_matches = 1
|
||||||
|
self.save
|
||||||
resetSchoolScores
|
resetSchoolScores
|
||||||
setSeedsAndRandomSeedingWrestlersWithoutSeeds
|
setSeedsAndRandomSeedingWrestlersWithoutSeeds
|
||||||
poolToBracket() if tournament_type == "Pool to bracket"
|
poolToBracket() if tournament_type == "Pool to bracket"
|
||||||
|
self.curently_generating_matches = nil
|
||||||
|
self.save
|
||||||
matches
|
matches
|
||||||
end
|
end
|
||||||
if Rails.env.production?
|
if Rails.env.production?
|
||||||
|
|||||||
5
db/migrate/20151230163202_generating_matches.rb
Normal file
5
db/migrate/20151230163202_generating_matches.rb
Normal file
@@ -0,0 +1,5 @@
|
|||||||
|
class GeneratingMatches < ActiveRecord::Migration
|
||||||
|
def change
|
||||||
|
add_column :tournaments, :curently_generating_matches, :integer
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -11,7 +11,7 @@
|
|||||||
#
|
#
|
||||||
# It's strongly recommended that you check this file into your version control system.
|
# It's strongly recommended that you check this file into your version control system.
|
||||||
|
|
||||||
ActiveRecord::Schema.define(version: 20151229220036) do
|
ActiveRecord::Schema.define(version: 20151230163202) do
|
||||||
|
|
||||||
create_table "delayed_jobs", force: :cascade do |t|
|
create_table "delayed_jobs", force: :cascade do |t|
|
||||||
t.integer "priority", default: 0, null: false
|
t.integer "priority", default: 0, null: false
|
||||||
@@ -93,6 +93,7 @@ ActiveRecord::Schema.define(version: 20151229220036) do
|
|||||||
t.text "tournament_type"
|
t.text "tournament_type"
|
||||||
t.text "weigh_in_ref"
|
t.text "weigh_in_ref"
|
||||||
t.integer "user_id"
|
t.integer "user_id"
|
||||||
|
t.integer "curently_generating_matches"
|
||||||
end
|
end
|
||||||
|
|
||||||
add_index "tournaments", ["user_id"], name: "index_tournaments_on_user_id"
|
add_index "tournaments", ["user_id"], name: "index_tournaments_on_user_id"
|
||||||
|
|||||||
Reference in New Issue
Block a user