@Override public Playoff updateFirstLeg(List<Result> results, Playoff playoff) { PlayoffFixture semiFinal = playoff.getSemiFinal(); if (semiFinal == null) { return null; } for (KnockoutPairing pairing : semiFinal.getPairings()) { PlayoffGame firstLeg = pairing.getFirstLeg(); firstLeg = playoffGameUpdatingService.updatePlayoffGame(firstLeg, results); pairing.setFirstLeg(firstLeg); } return playoff; }
@Override public Playoff updateSecondLeg(List<Result> results, Playoff playoff) { PlayoffFixture semiFinal = playoff.getSemiFinal(); if (semiFinal == null) { return null; } int index = 1; for (KnockoutPairing pairing : semiFinal.getPairings()) { PlayoffGame secondLeg = pairing.getSecondLeg(); secondLeg = playoffGameUpdatingService.updatePlayoffGame(secondLeg, results); Team promotedTeam = playoffPromotedTeamsService.determinePromotedTeam(pairing); pairing.setSecondLeg(secondLeg); pairing.setPromotedTeam(promotedTeam); semiFinal.getPromotedTeams().put(index, promotedTeam); index++; } return playoffInitializationService.initializeFinal(semiFinal.getPromotedTeams(), playoff); }