mirror of
https://github.com/jcwimer/wrestlingApp
synced 2026-04-08 23:34:51 +00:00
Trying to fix async jobs
This commit is contained in:
@@ -4,6 +4,9 @@ module GeneratesTournamentMatches
|
|||||||
poolToBracket() if tournament_type == "Pool to bracket"
|
poolToBracket() if tournament_type == "Pool to bracket"
|
||||||
matches
|
matches
|
||||||
end
|
end
|
||||||
|
if Rails.env.production?
|
||||||
|
handle_asynchronously :generateMatchups
|
||||||
|
end
|
||||||
|
|
||||||
def poolToBracket
|
def poolToBracket
|
||||||
resetSchoolScores
|
resetSchoolScores
|
||||||
|
|||||||
@@ -4,10 +4,7 @@ class Match < ActiveRecord::Base
|
|||||||
belongs_to :mat, touch: true
|
belongs_to :mat, touch: true
|
||||||
has_many :wrestlers, :through => :weight
|
has_many :wrestlers, :through => :weight
|
||||||
|
|
||||||
if Rails.env.production?
|
|
||||||
handle_asynchronously :advance_wrestlers
|
|
||||||
handle_asynchronously :calcSchoolPoints
|
|
||||||
end
|
|
||||||
|
|
||||||
after_update do
|
after_update do
|
||||||
if self.finished == 1 && self.winner_id != nil
|
if self.finished == 1 && self.winner_id != nil
|
||||||
@@ -28,6 +25,9 @@ class Match < ActiveRecord::Base
|
|||||||
wrestler2.school.calcScore
|
wrestler2.school.calcScore
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if Rails.env.production?
|
||||||
|
handle_asynchronously :calcSchoolPoints
|
||||||
|
end
|
||||||
|
|
||||||
def mat_assigned
|
def mat_assigned
|
||||||
if self.mat
|
if self.mat
|
||||||
@@ -57,6 +57,9 @@ class Match < ActiveRecord::Base
|
|||||||
self.mat.assignNextMatch
|
self.mat.assignNextMatch
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
if Rails.env.production?
|
||||||
|
handle_asynchronously :advance_wrestlers
|
||||||
|
end
|
||||||
|
|
||||||
def bracketScore
|
def bracketScore
|
||||||
if self.finished != 1
|
if self.finished != 1
|
||||||
|
|||||||
@@ -9,9 +9,7 @@ class Tournament < ActiveRecord::Base
|
|||||||
has_many :wrestlers, through: :weights
|
has_many :wrestlers, through: :weights
|
||||||
has_many :matches, dependent: :destroy
|
has_many :matches, dependent: :destroy
|
||||||
|
|
||||||
if Rails.env.production?
|
|
||||||
handle_asynchronously :generateMatchups
|
|
||||||
end
|
|
||||||
|
|
||||||
def resetSchoolScores
|
def resetSchoolScores
|
||||||
schools.update_all("score = 0.0")
|
schools.update_all("score = 0.0")
|
||||||
|
|||||||
Reference in New Issue
Block a user