diff options
-rw-r--r-- | app/models/match.rb | 4 | ||||
-rw-r--r-- | doc/Sprint3-Retrospective.md | 150 | ||||
-rw-r--r-- | lib/sampling/peer_review.rb | 20 | ||||
-rw-r--r-- | lib/scoring/README.md | 2 | ||||
-rw-r--r-- | lib/scoring/fibonacci_peer_with_blowout.rb | 16 | ||||
-rw-r--r-- | lib/scoring/marginal_peer.rb | 2 | ||||
-rw-r--r-- | lib/scoring/winner_takes_all.rb | 7 |
7 files changed, 178 insertions, 23 deletions
diff --git a/app/models/match.rb b/app/models/match.rb index 7b36777..1359695 100644 --- a/app/models/match.rb +++ b/app/models/match.rb @@ -19,7 +19,7 @@ class Match < ActiveRecord::Base # such that the match may be considered finished. def finished? ok = true - tournament_stage.scoring.stats_needed.each do |stat| + tournament_stage.scoring.stats_needed(self).each do |stat| ok &= !statistics.where(match: self, name: stat).nil? end ok @@ -80,7 +80,7 @@ class Match < ActiveRecord::Base def figure_sampling_methods if @sampling_methods.nil? data = {} - needed = self.tournament_stage.scoring.stats_needed + needed = self.tournament_stage.scoring.stats_needed(self) methods_names = self.tournament_stage.tournament.sampling_methods methods_names.each do |method_name| method_class = "Sampling::#{method_name.camelcase}".constantize diff --git a/doc/Sprint3-Retrospective.md b/doc/Sprint3-Retrospective.md new file mode 100644 index 0000000..da87a05 --- /dev/null +++ b/doc/Sprint3-Retrospective.md @@ -0,0 +1,150 @@ +--- +title: "Team 6 - Project Leaguer: Sprint 2 Retrospective" +author: [ Nathaniel Foy, Guntas Grewal, Tomer Kimia, Andrew Murrell, Luke Shumaker, Davis Webb ] +--- + +# Tasks + +The "size" is using the modified Fibonacci scale. A '1' is expected +to take less than an hour. A '3' is expected to take 3-6 hours. A +'5' should take the better part of a day or two. An 8 should take +several days. + ++---------------------------------------------------------+------+------------+----+ +| Tasks Implemented and Working | Size | Person\* | US | ++=========================================================+======+============+====+ +| [Intelligent Error Handling] (#error-hand) | 3 | Andrew | 3 | ++---------------------------------------------------------+------+------------+----+ +| [Search] (#search) | 5 | Tomer | 6 | ++---------------------------------------------------------+------+------------+----+ +| [Remote Game UserNames] (#remote_user) | 3 | Davis | 12 | ++---------------------------------------------------------+------+------------+----+ +| [Email verification] (#email-varify) | 8 | Luke | 2 | ++---------------------------------------------------------+------+------------+----+ +| [Alternate Scoring and pairing methods] (#alt-score-par)| 5 | G, A, D | 7,8| ++---------------------------------------------------------+------+------------+----+ +| [Tournament preference interface] (#tourn-prefer) | 3 | Andrew | 9 | ++---------------------------------------------------------+------+------------+----+ +| [More types of seeded settings] (#seed) | 2 | Andrew | 9 | ++---------------------------------------------------------+------+------------+----+ +| [Asynchronous Riot Pulls] (#async) | 5 | Nathaniel | 11 | ++---------------------------------------------------------+------+------------+----+ +| [Map out brackets scaffolding] (#brack-scaff) | 5 | Tomer | 10 | ++---------------------------------------------------------+------+------------+----+ +| [Create braket creation and submission gui] (#brack-gui)| 3 | Tomer | 10 | ++---------------------------------------------------------+------+------------+----+ +| [General Interface Cleanups] (#interface-cleean) | 2 | Tomer | 1 | ++---------------------------------------------------------+------+------------+----+ +| [Make it look professional] (#professional) | 3 | All | 1 | ++---------------------------------------------------------+------+------------+----+ +| [Expand Peer Evaluation] (#peer-expansion) | 3 | G, A, D | 7 | ++---------------------------------------------------------+------+------------+----+ +| [Private Messages] (#priv-messages) | 5 | N, L | 5 | ++---------------------------------------------------------+------+------------+----+ +| [Alerts] (#alerts) | 3 | Guntas | 4 | ++---------------------------------------------------------+------+------------+----+ +| [Project Leaguer Logo] (#logo) | spike| G, D | 1 | ++---------------------------------------------------------+------+------------+----+ + + + + ++---------------------------------------------------------+------+------------+----+ +| Tasks Implemented and Not Working Well | Size | Person\* | US | ++=========================================================+======+============+====+ +TODO + + + + ++---------------------------------------------------------+------+------------+----+ +| Tasks Not Implemented | Size | Person\* | US | ++=========================================================+======+============+====+ +TODO + + + + +# Implemented and working + +## Intelligent Error Handling (#error-hand) + +TODO + +## Search (#search) + +TODO + +## Remote Game UserNames (#remote_user) + +TODO + +## Email verification (#email-varify) + +TODO + +## Alternate Scoring and pairing methods (#alt-score-par) + +TODO + +## Tournament preference interface (#tourn-prefer) + +TODO + +## More types of seeded settings (#seed) + +TODO + +## Asynchronous Riot Pulls (#async) + +TODO + +## Map out brackets scaffolding (#brack-scaff) + +TODO + +## Create braket creation and submission gui (#brack-gui) + +TODO + +## General Interface Cleanups (#interface-cleean) + +TODO + +## Make it look professional (#professional) + +TODO + +## Expand Peer Evaluation (#peer-expansion) + +TODO + +## Private Messages (#priv-messages) + +TODO + +## Alerts (#alerts) + +TODO + +## Project Leaguer Logo (#logo)) + +TODO + + + +# Implemented but not working well + +TODO + + + +# Not implemented + +TODO + + + +# How to improve + +TODO diff --git a/lib/sampling/peer_review.rb b/lib/sampling/peer_review.rb index 1aabe34..7faa241 100644 --- a/lib/sampling/peer_review.rb +++ b/lib/sampling/peer_review.rb @@ -5,7 +5,7 @@ module Sampling end def self.can_get?(setting_name) - return setting_name.start_with?("feedback_from_") ? 2 : 0 + return setting_name.start_with?("review_from_") ? 2 : 0 end def self.uses_remote? @@ -33,7 +33,7 @@ module Sampling def render_user_interaction(user) @user = user @team = get_team(match) - @feedbacks_missing = get_feedbacks_missing(match) + @reviews_missing = get_reviews_missing(match) require 'erb' erb_filename = File.join(__FILE__.sub(/\.rb$/, '.html.erb')) @@ -46,7 +46,7 @@ module Sampling i = 0 params[:peer_review].to_s.split(',').each do |user_name| reviewed_user = User.find_by_user_name(user_name) - user.statistics.create(match: @match, value: i) + reviewed_user.statistics.create(match: @match, name: "review_from_#{reviewing_user.user_name}", value: i) i += 1 end end @@ -63,24 +63,24 @@ module Sampling match.teams.find{|t|t.users.include?(@user)} end - def self.get_feedbacks(match) + def self.get_reviews(match) ret = {} - match.statistiscs.where("'name' LIKE 'feedback_from_%'").each do |statistic| + match.statistiscs.where("'name' LIKE 'review_from_%'").each do |statistic| ret[statistic.user] ||= {} - ret[statistic.user][User.find_by_user_name(statistic.name.sub(/^feedback_from_/,''))] = statistic.value + ret[statistic.user][User.find_by_user_name(statistic.name.sub(/^review_from_/,''))] = statistic.value end return ret end - def self.get_feedbacks_missing(match) + def self.get_reviews_missing(match) require 'set' ret = Set.new - feedback = get_feedbacks(match) + review = get_reviews(match) users = get_users(match) - feedback.each do |feedback| - (users - feedback.keys).each do |user| + review.each do |review| + (users - review.keys).each do |user| ret.add(user) end end diff --git a/lib/scoring/README.md b/lib/scoring/README.md index dce71d0..efdc3cc 100644 --- a/lib/scoring/README.md +++ b/lib/scoring/README.md @@ -4,7 +4,7 @@ Scoring interface Files in this directory should be _modules_ implementing the following interface: - - `stats_needed(Match) => Array[]=Symbol` + - `stats_needed(Match) => Array[]=String` Returns which statistics need to be collected for this scoring algorithm. diff --git a/lib/scoring/fibonacci_peer_with_blowout.rb b/lib/scoring/fibonacci_peer_with_blowout.rb index 9d72643..a13d76c 100644 --- a/lib/scoring/fibonacci_peer_with_blowout.rb +++ b/lib/scoring/fibonacci_peer_with_blowout.rb @@ -1,15 +1,17 @@ module Scoring module FibonacciPeerWithBlowout - def self.stats_needed - return ["votes", "win", "blowout"] + def self.stats_needed(match) + return ["votes", "win", "blowout"] + match.users.map{|u|"review_from_#{u.user_name}"} end def self.score(match) scores = {} match.users.each do |user| - stats = Statistic.where(user: user, match: match) - - votes = stats.where(name: "votes" ).first.value + stats = user.statistics.where(match: match) + votes = 0 + match.users.each do |u| + votes += convert_place_to_votes stats.where(name: "review_from_#{u.user_name}").first.value + end win = stats.where(name: "win" ).first.value blowout = stats.where(name: "blowout").first.value scores[user] = self.score_user(votes, win, blowout) @@ -23,5 +25,9 @@ module Scoring fibonacci = Hash.new { |h,k| h[k] = k < 2 ? k : h[k-1] + h[k-2] } fibonacci[votes+3] + (win ? blowout ? 12 : 10 : blowout ? 5 : 7) end + + def self.convert_place_to_votes(place) + (place == 0 or place == 1) ? 1 : 0 + end end end diff --git a/lib/scoring/marginal_peer.rb b/lib/scoring/marginal_peer.rb index 8559b3d..f2c0272 100644 --- a/lib/scoring/marginal_peer.rb +++ b/lib/scoring/marginal_peer.rb @@ -1,6 +1,6 @@ module Scoring module MarginalPeer - def self.stats_needed + def self.stats_needed(match) return ["rating", "win"] end diff --git a/lib/scoring/winner_takes_all.rb b/lib/scoring/winner_takes_all.rb index 9c83fb9..db494c6 100644 --- a/lib/scoring/winner_takes_all.rb +++ b/lib/scoring/winner_takes_all.rb @@ -1,15 +1,14 @@ module Scoring module WinnerTakesAll - def self.stats_needed - #return ["win"] - ["win", "numDeaths", "turretsKilled", "championsKilled", "minionsKilled", "assists"] + def self.stats_needed(match) + return ["win"] end def self.score(match) scores = {} match.users.each do |user| stats = Statistic.where(user: user, match: match) - scores[user] = score_user(stats.where(name: "win").first.value) + scores[user] = score_user(stats.where(name: "win").first) end scores end |