Improve Formatting in playoff_stage_service (I guess)

... Rubocop wanted it that way
This commit is contained in:
Daniel Schädler 2019-05-11 17:30:41 +02:00
parent e4c868c150
commit 4e907b1fc8
1 changed files with 7 additions and 7 deletions

View File

@ -74,12 +74,12 @@ class PlayoffStageService
def self.populate_match_with_winners(match, first_match, second_match) def self.populate_match_with_winners(match, first_match, second_match)
match_scores = match.match_scores.sort_by(&:id) match_scores = match.match_scores.sort_by(&:id)
matches = [first_match, second_match].sort_by(&:position) matches = [first_match, second_match].sort_by(&:position)
winners = [] winners = if second_match.finished?
if second_match.finished? matches.map(&:winner)
winners = matches.map(&:winner)
else else
winners = matches.map{ |m| matches.map do |m|
m == first_match ? m.winner : nil } m == first_match ? m.winner : nil
end
end end
# depending on the amount of match_scores already present we need to do different things # depending on the amount of match_scores already present we need to do different things