diff --git a/app/controllers/static_pages_controller.rb b/app/controllers/static_pages_controller.rb
index 77ac531..e94c456 100644
--- a/app/controllers/static_pages_controller.rb
+++ b/app/controllers/static_pages_controller.rb
@@ -8,7 +8,7 @@ class StaticPagesController < ApplicationController
@tournament = Tournament.find(params[:tournament])
end
if @tournament
- @bouts = @tournament.bouts
+ @matches = Match.where(tournament_id: @tournament.id)
end
end
def results
diff --git a/app/models/pool.rb b/app/models/pool.rb
new file mode 100644
index 0000000..be7d780
--- /dev/null
+++ b/app/models/pool.rb
@@ -0,0 +1,31 @@
+class Pool
+ def onePool(wrestlers,weight_id,tournament)
+ wrestlers.each do |w|
+ w.isWrestlingThisRound?(1)
+ end
+
+ end
+
+
+ def twoPools(wrestlers)
+
+ end
+
+
+ def fourPools(wrestlers)
+
+ end
+
+
+
+ def createMatch(w1,w2,round,tournament)
+
+ @match = Match.new
+ @match.r_id = w1
+ @match.g_id = w2
+ @match.round = round
+ @match.tournament_id = tournament
+ @match.save
+ end
+
+end
\ No newline at end of file
diff --git a/app/models/weight.rb b/app/models/weight.rb
index 0e8f91b..a892a9b 100644
--- a/app/models/weight.rb
+++ b/app/models/weight.rb
@@ -7,11 +7,14 @@ class Weight < ActiveRecord::Base
def generatePool
@wrestlers = Wrestler.where(weight_id: self.id)
if self.pools == 1
- onePool(@wrestlers)
+ @pool = Pool.new
+ @pool.onePool(@wrestlers,self.id,self.tournament_id)
elsif self.pools == 2
-
+ @pool = Pool.new
+ @pool.twoPools(@wrestlers,self.id,self.tournament_id)
elsif self.pools == 4
-
+ @pool = Pool.new
+ @pool.fourPools(@wrestlers,self.id,self.tournament_id)
end
end
@@ -26,16 +29,5 @@ class Weight < ActiveRecord::Base
end
end
- def fourPool
-
- end
- def onePool(wrestlers)
- wrestlers.each do |wrestler|
- wrestler.poolNumber = 1
- wrestler.save
- end
- end
-
-
end
diff --git a/app/models/wrestler.rb b/app/models/wrestler.rb
index 53bc010..2fcdbf7 100644
--- a/app/models/wrestler.rb
+++ b/app/models/wrestler.rb
@@ -2,4 +2,14 @@ class Wrestler < ActiveRecord::Base
belongs_to :school
belongs_to :weight
has_many :matches
+
+ def isWrestlingThisRound?(round)
+ @r_id = Match.where(r_id: self.id, round: round)
+ @g_id = Match.where(g_id: self.id, round: round)
+ if @r_id or @g_id
+ return true
+ else
+ return false
+ end
+ end
end
diff --git a/app/views/static_pages/up_matches.html.erb b/app/views/static_pages/up_matches.html.erb
index 3b263e6..456ac23 100644
--- a/app/views/static_pages/up_matches.html.erb
+++ b/app/views/static_pages/up_matches.html.erb
@@ -2,7 +2,7 @@