From e5cb2b00b56077ab273a04722915adfaa16e27f4 Mon Sep 17 00:00:00 2001 From: Malaber <32635600+Malaber@users.noreply.github.com> Date: Sat, 11 May 2019 17:30:41 +0200 Subject: [PATCH] Improve Formatting in playoff_stage_service (I guess) ... Rubocop wanted it that way --- app/services/playoff_stage_service.rb | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/services/playoff_stage_service.rb b/app/services/playoff_stage_service.rb index 481bee5..9d747a6 100644 --- a/app/services/playoff_stage_service.rb +++ b/app/services/playoff_stage_service.rb @@ -74,13 +74,13 @@ class PlayoffStageService def self.populate_match_with_winners(match, first_match, second_match) match_scores = match.match_scores.sort_by(&:id) matches = [first_match, second_match].sort_by(&:position) - winners = [] - if second_match.finished? - winners = matches.map(&:winner) - else - winners = matches.map{ |m| - m == first_match ? m.winner : nil } - end + winners = if second_match.finished? + matches.map(&:winner) + else + matches.map do |m| + m == first_match ? m.winner : nil + end + end # depending on the amount of match_scores already present we need to do different things case match_scores.size