summaryrefslogtreecommitdiff
path: root/app/models/user.rb
diff options
context:
space:
mode:
authorAndrewMurrell <amurrel@purdue.edu>2014-04-24 00:46:42 -0400
committerAndrewMurrell <amurrel@purdue.edu>2014-04-24 00:46:42 -0400
commit1942d4307f392d61d13cdc488fecd523f55e427d (patch)
treed4ad5210f28a2c07aaca9548ebd883e1672cd2d8 /app/models/user.rb
parent1429cd41bb4af3429f28dc97efd6994433ebde7b (diff)
Fixed Spacing, Scoring, and began implementing statistics
Diffstat (limited to 'app/models/user.rb')
-rw-r--r--app/models/user.rb6
1 files changed, 5 insertions, 1 deletions
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?