Skip to content
Snippets Groups Projects
Commit 9022572b authored by Häderle Marius's avatar Häderle Marius
Browse files

08.01.2024 - added method updateTeamScore to Service #24

parent 99be5327
No related branches found
No related tags found
1 merge request!7Dev in Main Merge
......@@ -183,11 +183,31 @@ public class TournamentService {
log.debug("Team " + teamId + " assign to Match " + matchId + " in Tournament " + tournamentId);
}
public void updateTeamScore(UUID tournamentId, UUID matchId, UUID teamId, int newScore)throws TournamentIdNotFoundException, MatchIdNotFoundException, TeamIdNotFoundException{
Tournament tournament = tournamentRepository.findById(tournamentId)
.orElseThrow(() -> new TournamentIdNotFoundException(tournamentId));
Match match = tournament.getMatches().stream()
.filter(m -> m.getMatchId().equals(matchId))
.findFirst()
.orElseThrow(() -> new MatchIdNotFoundException(matchId));
if (!match.getTeamScores().containsKey(teamId)) {
throw new TeamIdNotFoundException(teamId);
}
match.getTeamScores().put(teamId, newScore);
tournamentRepository.save(tournament);
log.debug("Score von Team " + teamId + " auf " + newScore + " geupdatet");
}
/*
Weitere Methoden:
Gewinner bestimmen, defineWinner()
Teams Matches zuordnen,
UpdateTeamScore Marius
Tunier beenden
GetTournament Leon
DeleteTournament Leon
User Mattis
*/
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment