mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-03-25 01:14:43 +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
|
||||
if @tournament
|
||||
if @tournament.matches.empty?
|
||||
if @tournament.matches.empty? or @tournament.curently_generating_matches == 1
|
||||
redirect_to "/tournaments/#{@tournament.id}/no_matches"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
module GeneratesTournamentMatches
|
||||
|
||||
def generateMatchups
|
||||
self.curently_generating_matches = 1
|
||||
self.save
|
||||
resetSchoolScores
|
||||
setSeedsAndRandomSeedingWrestlersWithoutSeeds
|
||||
poolToBracket() if tournament_type == "Pool to bracket"
|
||||
self.curently_generating_matches = nil
|
||||
self.save
|
||||
matches
|
||||
end
|
||||
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.
|
||||
|
||||
ActiveRecord::Schema.define(version: 20151229220036) do
|
||||
ActiveRecord::Schema.define(version: 20151230163202) do
|
||||
|
||||
create_table "delayed_jobs", force: :cascade do |t|
|
||||
t.integer "priority", default: 0, null: false
|
||||
@@ -93,6 +93,7 @@ ActiveRecord::Schema.define(version: 20151229220036) do
|
||||
t.text "tournament_type"
|
||||
t.text "weigh_in_ref"
|
||||
t.integer "user_id"
|
||||
t.integer "curently_generating_matches"
|
||||
end
|
||||
|
||||
add_index "tournaments", ["user_id"], name: "index_tournaments_on_user_id"
|
||||
|
||||
Reference in New Issue
Block a user