Implement method to check which is leading

This commit is contained in:
Daniel Schädler 2019-05-29 15:43:24 +02:00
parent 810d541791
commit 26267deba0
1 changed files with 7 additions and 2 deletions

View File

@ -19,13 +19,18 @@ class Match < ApplicationRecord
stage ? stage.owner : group.owner
end
def winner
return nil unless finished?
def current_leading_team
return nil if match_scores.first.points == match_scores.second.points
match_scores.max_by(&:points).team
end
def winner
return nil unless finished?
current_leading_team
end
def group_match?
group.present?
end