From 2e7e34125b2006b366b54bbb61aac92cac86153b Mon Sep 17 00:00:00 2001 From: Jacob Cody Wimer Date: Mon, 9 Feb 2015 12:31:14 -0500 Subject: [PATCH] Updated match generation view, created a bracket_type for weight, and add DQ as a win type. --- app/models/match.rb | 2 +- app/models/weight.rb | 12 +++++++++++- app/views/static_pages/generate_matches.html.erb | 7 ++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/app/models/match.rb b/app/models/match.rb index 3b89890..9bd9066 100644 --- a/app/models/match.rb +++ b/app/models/match.rb @@ -1,6 +1,6 @@ class Match < ActiveRecord::Base belongs_to :tournament - WIN_TYPES = ["Decision", "Major", "Tech Fall", "Pin", "Forfeit", "Injury Default", "Default"] + WIN_TYPES = ["Decision", "Major", "Tech Fall", "Pin", "Forfeit", "Injury Default", "Default", "DQ"] attr_accessor :weight_max def weight_max diff --git a/app/models/weight.rb b/app/models/weight.rb index 102a74a..60969de 100644 --- a/app/models/weight.rb +++ b/app/models/weight.rb @@ -2,7 +2,7 @@ class Weight < ActiveRecord::Base belongs_to :tournament has_many :wrestlers, dependent: :destroy - attr_accessor :pools, :bracket_size + attr_accessor :pools, :bracket_size, :bracket_type def generatePool @wrestlers = Wrestler.where(weight_id: self.id) @@ -35,5 +35,15 @@ class Weight < ActiveRecord::Base return @wrestlers.size end + def bracket_type + if self.wrestlers.size > 7 && self.wrestlers.size <= 10 + return "twoPoolsToSemi" + elsif self.wrestlers.size == 11 + return "fourPoolsToQuarter" + elsif self.wrestlers.size > 11 && self.wrestlers.size <= 16 + return "fourPoolsToSemi" + end + self.wrestlers.size + end end diff --git a/app/views/static_pages/generate_matches.html.erb b/app/views/static_pages/generate_matches.html.erb index c5d6ff8..a2789fe 100644 --- a/app/views/static_pages/generate_matches.html.erb +++ b/app/views/static_pages/generate_matches.html.erb @@ -1,3 +1,8 @@ <%= link_to "Back to #{@tournament.name}", "/tournaments/#{@tournament.id}" %> +
+
+
+The server is running processes in the background. +
+Please allow up to 10 minutes for all matches to be created.
-Done! \ No newline at end of file