From 0c072b77192b077982fbdd2bb7c2fb7b20f72303 Mon Sep 17 00:00:00 2001 From: Malaber <32635600+Malaber@users.noreply.github.com> Date: Wed, 5 Jun 2019 00:11:10 +0200 Subject: [PATCH] One Liners everywhere! MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Jonas apparently thinks this is better then it was before.. i don't really care so here we go ¯\_(ツ)_/¯ --- app/models/match.rb | 12 +++--------- 1 file changed, 3 insertions(+), 9 deletions(-) diff --git a/app/models/match.rb b/app/models/match.rb index 64592c6..bc80977 100644 --- a/app/models/match.rb +++ b/app/models/match.rb @@ -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)