summaryrefslogtreecommitdiff
path: root/app/models/match.rb
diff options
context:
space:
mode:
authorAndrewMurrell <amurrel@purdue.edu>2014-04-22 01:53:05 -0400
committerAndrewMurrell <amurrel@purdue.edu>2014-04-22 01:53:05 -0400
commit257f6393e81ffaef00bb4a738973eaacba02d21e (patch)
tree2dd32c253bb6d52c7acc88c0eb93d26d2144cd67 /app/models/match.rb
parentaa8437947b28dda73bcfaf3caccb738e5e2f48b3 (diff)
added match.win?(player) for checking if a player won a match or not
Diffstat (limited to 'app/models/match.rb')
-rw-r--r--app/models/match.rb4
1 files changed, 4 insertions, 0 deletions
diff --git a/app/models/match.rb b/app/models/match.rb
index ac74fe1..83d7d72 100644
--- a/app/models/match.rb
+++ b/app/models/match.rb
@@ -38,4 +38,8 @@ class Match < ActiveRecord::Base
end
#handle_asynchronously :is_match_over
+ def win?(player)
+ winner.players.include? player
+ end
+
end