diff options
author | AndrewMurrell <amurrel@purdue.edu> | 2014-04-07 04:47:50 -0400 |
---|---|---|
committer | AndrewMurrell <amurrel@purdue.edu> | 2014-04-07 04:47:50 -0400 |
commit | c8b4045ba1ca02e750d6e8b15a1ced47b1930217 (patch) | |
tree | c5cb5380e61509541e8d6f1a17ca319267e4dca0 | |
parent | b5f430fd59f7140722cc7940356c1de1ddd6f4d4 (diff) |
It works. Users can do peer review.
-rw-r--r-- | app/controllers/matches_controller.rb | 5 | ||||
-rw-r--r-- | app/models/tournament.rb | 2 | ||||
-rw-r--r-- | db/schema.rb | 1 |
3 files changed, 4 insertions, 4 deletions
diff --git a/app/controllers/matches_controller.rb b/app/controllers/matches_controller.rb index 3c93eac..69ea23b 100644 --- a/app/controllers/matches_controller.rb +++ b/app/controllers/matches_controller.rb @@ -215,8 +215,9 @@ class MatchesController < ApplicationController base_score = next_score next_score += base_score end - @match.submitted_peer_reviews += 1 - if (@match.submitted_peer_reviews == @match.players.count) + @match.submitted_peer_evaluations += 1 + players = []; @match.teams.each{|t| players.concat(t.users.all)} + if (@match.submitted_peer_evaluations == players.count) @match.status = 3 end respond_to do |format| diff --git a/app/models/tournament.rb b/app/models/tournament.rb index aa331f0..4cbbf95 100644 --- a/app/models/tournament.rb +++ b/app/models/tournament.rb @@ -109,7 +109,7 @@ class Tournament < ActiveRecord::Base num_teams = (self.players.count/self.min_players_per_team).floor num_matches = num_teams - 1 for i in 1..num_matches - self.matches.create(name: "Match #{i}", status: 0) + self.matches.create(name: "Match #{i}", status: 0, submitted_peer_evaluations: 0) end match_num = num_matches-1 team_num = 0 diff --git a/db/schema.rb b/db/schema.rb index 9dbf69a..9214da8 100644 --- a/db/schema.rb +++ b/db/schema.rb @@ -72,7 +72,6 @@ ActiveRecord::Schema.define(version: 20140407081524) do create_table "matches", force: true do |t| t.integer "status" t.integer "tournament_id" - t.integer "submitted_peer_evaluations" t.string "name" t.integer "winner_id" t.string "remote_id" |