From 1942d4307f392d61d13cdc488fecd523f55e427d Mon Sep 17 00:00:00 2001 From: AndrewMurrell Date: Thu, 24 Apr 2014 00:46:42 -0400 Subject: Fixed Spacing, Scoring, and began implementing statistics --- app/assets/javascripts/tournaments/show.js.coffee | 2 +- app/controllers/matches_controller.rb | 5 +++++ app/models/user.rb | 6 +++++- app/views/matches/show.html.erb | 2 +- 4 files changed, 12 insertions(+), 3 deletions(-) (limited to 'app') diff --git a/app/assets/javascripts/tournaments/show.js.coffee b/app/assets/javascripts/tournaments/show.js.coffee index ef6bb82..8620210 100644 --- a/app/assets/javascripts/tournaments/show.js.coffee +++ b/app/assets/javascripts/tournaments/show.js.coffee @@ -29,4 +29,4 @@ update = (tournament) -> # Now kick off the whole process window.onload = -> - $.ajax(url: json_url).done update + $.ajax(url: json_url).done update diff --git a/app/controllers/matches_controller.rb b/app/controllers/matches_controller.rb index 254f797..8a8b9ca 100644 --- a/app/controllers/matches_controller.rb +++ b/app/controllers/matches_controller.rb @@ -142,6 +142,11 @@ class MatchesController < ApplicationController end end when "finish" + + #make this use the statistics interface for scoring and ScoringAlgorithms + + + # Individual scores scores = params["scores"] scores.each do |user_name, score| diff --git a/app/models/user.rb b/app/models/user.rb index 5c0b5b1..e5ae7ea 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -5,7 +5,7 @@ class User < ActiveRecord::Base has_and_belongs_to_many :tournaments_hosted, class_name: "Tournament", foreign_key: "host_id", join_table: "hosts_tournaments" has_and_belongs_to_many :teams has_many :sessions - has_many :scores + has_many :statistics has_many :remote_usernames apply_simple_captcha @@ -23,6 +23,10 @@ class User < ActiveRecord::Base self.permissions ||= Server.first.default_user_permissions end + def scores + self.statistics.find_by_name(:score) + end + def find_remote_username(game) obj = self.remote_usernames.where(:game => game).first if obj.nil? diff --git a/app/views/matches/show.html.erb b/app/views/matches/show.html.erb index e61d6b3..e9809a2 100644 --- a/app/views/matches/show.html.erb +++ b/app/views/matches/show.html.erb @@ -82,7 +82,7 @@ function score_peers() { <% team.users.collect{|u| u.user_name}.each do |k| %><% end %> -- cgit v1.2.3-54-g00ecf