fix contains

Springboot
Victor SOULIER 1 year ago
parent 85d737845f
commit fd688a10f7

@ -89,7 +89,7 @@ public class PartieKahootController {
Joueur joueur = this.joueurService.findById(request.getIdJoueur()); Joueur joueur = this.joueurService.findById(request.getIdJoueur());
PartieKahoot partie = this.partieKahootService.getPartieKahootByIdOrCodeInvitation(codeInvitation); PartieKahoot partie = this.partieKahootService.getPartieKahootByIdOrCodeInvitation(codeInvitation);
if(!partie.getStatus().equals(Status.Pending)) throw new PartyAlreadyStartedException(); if(!partie.getStatus().equals(Status.Pending)) throw new PartyAlreadyStartedException();
if(!partie.getJoueurs().contains(joueur)){ if(!partie.getJoueurs().stream().anyMatch(j -> j.getId() == joueur.getId())){
ScorePartieKahootJoueur score = new ScorePartieKahootJoueur(); ScorePartieKahootJoueur score = new ScorePartieKahootJoueur();
score.setId(new ScorePartieKahootJoueurKey(joueur.getId(), partie.getId())); score.setId(new ScorePartieKahootJoueurKey(joueur.getId(), partie.getId()));
score.setJoueur(joueur); score.setJoueur(joueur);

Loading…
Cancel
Save