Add evaluate winner method
This commit is contained in:
parent
ae41d1a2a5
commit
4de6847edc
|
|
@ -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