Add evaluate winner method
This commit is contained in:
parent
27646e904c
commit
4fb8b75769
|
|
@ -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
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue