One Liners everywhere!
Jonas apparently thinks this is better then it was before.. i don't really care so here we go ¯\_(ツ)_/¯
This commit is contained in:
parent
f9a9ce635c
commit
0c072b7719
|
|
@ -26,9 +26,7 @@ class Match < ApplicationRecord
|
|||
end
|
||||
|
||||
def winner
|
||||
return nil unless finished?
|
||||
|
||||
current_leading_team
|
||||
finished? ? current_leading_team : nil
|
||||
end
|
||||
|
||||
def group_match?
|
||||
|
|
@ -36,15 +34,11 @@ class Match < ApplicationRecord
|
|||
end
|
||||
|
||||
def scored_points_of(team)
|
||||
return 0 unless teams.include?(team)
|
||||
|
||||
match_scores.find_by(team: team).points
|
||||
teams.include?(team) ? match_scores.find_by(team: team).points : 0
|
||||
end
|
||||
|
||||
def received_points_of(team)
|
||||
return 0 unless teams.include?(team)
|
||||
|
||||
match_scores.find { |ms| ms.team != team }.points
|
||||
teams.include?(team) ? match_scores.find { |ms| ms.team != team }.points : 0
|
||||
end
|
||||
|
||||
def group_points_of(team)
|
||||
|
|
|
|||
Loading…
Reference in New Issue