Implement method to check which is leading
This commit is contained in:
parent
810d541791
commit
26267deba0
|
|
@ -19,13 +19,18 @@ class Match < ApplicationRecord
|
||||||
stage ? stage.owner : group.owner
|
stage ? stage.owner : group.owner
|
||||||
end
|
end
|
||||||
|
|
||||||
def winner
|
def current_leading_team
|
||||||
return nil unless finished?
|
|
||||||
return nil if match_scores.first.points == match_scores.second.points
|
return nil if match_scores.first.points == match_scores.second.points
|
||||||
|
|
||||||
match_scores.max_by(&:points).team
|
match_scores.max_by(&:points).team
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def winner
|
||||||
|
return nil unless finished?
|
||||||
|
|
||||||
|
current_leading_team
|
||||||
|
end
|
||||||
|
|
||||||
def group_match?
|
def group_match?
|
||||||
group.present?
|
group.present?
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue