diff --git a/app/models/match.rb b/app/models/match.rb index 2779fa7..5779038 100644 --- a/app/models/match.rb +++ b/app/models/match.rb @@ -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