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
|
end
|
||||||
|
|
||||||
def winner
|
def winner
|
||||||
return nil unless finished?
|
finished? ? current_leading_team : nil
|
||||||
|
|
||||||
current_leading_team
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def group_match?
|
def group_match?
|
||||||
|
|
@ -36,15 +34,11 @@ class Match < ApplicationRecord
|
||||||
end
|
end
|
||||||
|
|
||||||
def scored_points_of(team)
|
def scored_points_of(team)
|
||||||
return 0 unless teams.include?(team)
|
teams.include?(team) ? match_scores.find_by(team: team).points : 0
|
||||||
|
|
||||||
match_scores.find_by(team: team).points
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def received_points_of(team)
|
def received_points_of(team)
|
||||||
return 0 unless teams.include?(team)
|
teams.include?(team) ? match_scores.find { |ms| ms.team != team }.points : 0
|
||||||
|
|
||||||
match_scores.find { |ms| ms.team != team }.points
|
|
||||||
end
|
end
|
||||||
|
|
||||||
def group_points_of(team)
|
def group_points_of(team)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue