summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/scheduling/elimination.rb2
-rw-r--r--lib/scheduling/round_robin.rb2
-rw-r--r--lib/scoring/fibonacci_peer_with_blowout.rb10
3 files changed, 10 insertions, 4 deletions
diff --git a/lib/scheduling/elimination.rb b/lib/scheduling/elimination.rb
index 73aefb4..44ce81e 100644
--- a/lib/scheduling/elimination.rb
+++ b/lib/scheduling/elimination.rb
@@ -11,7 +11,7 @@ module Scheduling
num_teams = (tournament.players.count/tournament.min_players_per_team).floor
num_matches = (Float(num_teams - tournament.min_teams_per_match)/(tournament.min_teams_per_match - 1)).ceil + 1
for i in 1..num_matches
- tournament_stage.matches.create(status: 0, submitted_peer_evaluations: 0)
+ tournament_stage.matches.create
end
match_num = num_matches-1
diff --git a/lib/scheduling/round_robin.rb b/lib/scheduling/round_robin.rb
index c0d68d3..7ee617d 100644
--- a/lib/scheduling/round_robin.rb
+++ b/lib/scheduling/round_robin.rb
@@ -20,7 +20,7 @@ module Scheduling
# => Create new matches
@matches_per_round.times do
- tournament_stage.matches.create(status: 0, submitted_peer_evaluations: 0)
+ tournament_stage.matches.create
end
# => seed the first time
diff --git a/lib/scoring/fibonacci_peer_with_blowout.rb b/lib/scoring/fibonacci_peer_with_blowout.rb
index 21ffab1..f592540 100644
--- a/lib/scoring/fibonacci_peer_with_blowout.rb
+++ b/lib/scoring/fibonacci_peer_with_blowout.rb
@@ -1,13 +1,19 @@
module Scoring
module FibonacciPeerWithBlowout
def self.stats_needed
- return [:votes]
+ return [:votes, :win, :blowout]
end
def self.score(match)
scores = {}
match.players.each do |player|
- scores[player] = self.score_user(match.statistics.where(user: player, name: :votes).first, match.win?(player), match.blowout)
+ stats = Statistics.where(user: player, match: match)
+
+ votes = stats.where(name: :votes ).first
+ win = stats.where(name: :win ).first
+ blowout = stats.where(name: :blowout).first
+
+ scores[player] = self.score_user(votes, win, blowout)
end
scores
end