Add evaluate winner method

This commit is contained in:
Daniel Schädler 2019-05-09 09:09:54 +02:00
parent 27646e904c
commit 4fb8b75769
1 changed files with 6 additions and 0 deletions

View File

@ -21,6 +21,12 @@ class Match < ApplicationRecord
private private
def evaluate_winner
return nil if match_scores.first.points == match_scores.second.points
match_scores.max_by(&:points).team
end
def stage_xor_group def stage_xor_group
errors.add(:stage_xor_group, 'Stage and Group missing or both present') unless stage.present? ^ group.present? errors.add(:stage_xor_group, 'Stage and Group missing or both present') unless stage.present? ^ group.present?
end end