fix initiation score à l'ajout d'un joueur

Springboot
Victor SOULIER 1 year ago
parent 161ae36542
commit 1ddd0e1e5c

@ -67,10 +67,12 @@ public class PartieKahootController {
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().contains(joueur)){
ScorePartieKahootJoueur score = new ScorePartieKahootJoueur(); ScorePartieKahootJoueur score = new ScorePartieKahootJoueur();
score.setPartie(partie); score.setId(new ScorePartieKahootJoueurKey(joueur.getId(), partie.getId()));
score.setJoueur(joueur); score.setJoueur(joueur);
score.setPartie(partie);
partie.getScores().add(score); partie.getScores().add(score);
partie.getJoueurs().add(joueur); partie.getJoueurs().add(joueur);
this.scorePartieKahootJoueurRepository.save(score);
} }
return this.modelMapper.map(this.partieKahootService.update(partie), PartieKahootDTO.class); return this.modelMapper.map(this.partieKahootService.update(partie), PartieKahootDTO.class);
} }

Loading…
Cancel
Save