diff --git a/science-quest/src/components/jeux/kahoot/KahootPartie.vue b/science-quest/src/components/jeux/kahoot/KahootPartie.vue index 257d32d..5d2b839 100644 --- a/science-quest/src/components/jeux/kahoot/KahootPartie.vue +++ b/science-quest/src/components/jeux/kahoot/KahootPartie.vue @@ -32,6 +32,7 @@ export default { }, //variables pour les scores score:{ + score:0, pointsGagne:0, }, pointsAnimation:0, @@ -81,7 +82,7 @@ export default { }, obtenirScores(){ this.resetEtats() //cacher l'etat precedent - this.kahootAPI.obtenirScore().then(response=>{ + this.kahootAPI.obtenirScore(this.score.score).then(response=>{ this.tempsLimite=response.tempsLimite this.score=response //afficher cet etat diff --git a/science-quest/src/data/kahoot.js b/science-quest/src/data/kahoot.js index 362e75b..56d6f6f 100644 --- a/science-quest/src/data/kahoot.js +++ b/science-quest/src/data/kahoot.js @@ -15,12 +15,12 @@ export class Kahoot{ const response=await fetch(`${REST_API}/partie/kahoot/${this.codeInvitation}/question`) return new KahootQuestion(await response.json()) } - async obtenirScore(){ + async obtenirScore(ancienScore=0){ const user = await Utilisateur.utilisateurConnecteOuCreerInvite() const response=await fetch(`${REST_API}/partie/kahoot/${this.codeInvitation}/status`) let json=await response.json() json.score=json.scores.find(score=>score.joueur.id==user.id).score - json.pointsGagne=0 + json.pointsGagne=json.score-ancienScore return new KahootScore(json) } async repondreQuestion(id){