1
0
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:
2015-12-30 16:36:53 +00:00
parent 74577eb9ec
commit 6d21e8ebdf
4 changed files with 12 additions and 2 deletions

View File

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

View File

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

View File

@@ -0,0 +1,5 @@
class GeneratingMatches < ActiveRecord::Migration
def change
add_column :tournaments, :curently_generating_matches, :integer
end
end

View File

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