From 1ddd0e1e5c8ddbf4cda3d7ba5aa66087ce617e8c Mon Sep 17 00:00:00 2001 From: visoulier Date: Sun, 31 Mar 2024 04:32:01 +0200 Subject: [PATCH] =?UTF-8?q?fix=20initiation=20score=20=C3=A0=20l'ajout=20d?= =?UTF-8?q?'un=20joueur?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../sciencequest/sae/controllers/PartieKahootController.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/SpringBootProject/src/main/java/fr/iut/sciencequest/sae/controllers/PartieKahootController.java b/SpringBootProject/src/main/java/fr/iut/sciencequest/sae/controllers/PartieKahootController.java index 704d8c1..7cc3d92 100644 --- a/SpringBootProject/src/main/java/fr/iut/sciencequest/sae/controllers/PartieKahootController.java +++ b/SpringBootProject/src/main/java/fr/iut/sciencequest/sae/controllers/PartieKahootController.java @@ -67,10 +67,12 @@ public class PartieKahootController { if(!partie.getStatus().equals(Status.Pending)) throw new PartyAlreadyStartedException(); if(!partie.getJoueurs().contains(joueur)){ ScorePartieKahootJoueur score = new ScorePartieKahootJoueur(); - score.setPartie(partie); + score.setId(new ScorePartieKahootJoueurKey(joueur.getId(), partie.getId())); score.setJoueur(joueur); + score.setPartie(partie); partie.getScores().add(score); partie.getJoueurs().add(joueur); + this.scorePartieKahootJoueurRepository.save(score); } return this.modelMapper.map(this.partieKahootService.update(partie), PartieKahootDTO.class); }