From 2244bbe8415acdf6401a8e71ac488724ae44e013 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Th=C3=A9ophile=20HUSS?= <theophile.huss@etu.unistra.fr>
Date: Fri, 6 Dec 2024 16:00:05 +0100
Subject: [PATCH] feat: Add idQuiz on play-quiz page

---
 src/app/modules/home/play-quiz/play-quiz.component.html | 6 +++---
 src/app/modules/home/play-quiz/play-quiz.component.ts   | 8 ++++----
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/app/modules/home/play-quiz/play-quiz.component.html b/src/app/modules/home/play-quiz/play-quiz.component.html
index d2897da..5fdd8c7 100644
--- a/src/app/modules/home/play-quiz/play-quiz.component.html
+++ b/src/app/modules/home/play-quiz/play-quiz.component.html
@@ -1,6 +1,7 @@
 <div *ngIf="!isLoading" class="main">
     <div class="header">
         <mat-icon (click)="goHome()">home</mat-icon>
+        <p>ID Quiz {{ idQuiz }}</p>
         <div class="title">
             <h4>Question {{ actualQuestionIndex + 1 }}/{{ quiz.questions.length }}</h4>
             <h5>Score : {{ score }}/{{ quiz.questions.length }}</h5>
@@ -13,9 +14,8 @@
     </div>
     <div class="next-question">
         <button *ngIf="showNextQuestion" (click)="nextQuestion()" class="btnNext">
-            @if (actualQuestionIndex === this.quiz.questionIndex - 1 + this.quiz.questions.length - 1) { Finish quiz
-            }
+            @if (actualQuestionIndex === this.quiz.questionIndex - 1 + this.quiz.questions.length - 1) { Finish quiz }
             @else { Next question }
         </button>
     </div>
-</div>
\ No newline at end of file
+</div>
diff --git a/src/app/modules/home/play-quiz/play-quiz.component.ts b/src/app/modules/home/play-quiz/play-quiz.component.ts
index 71067f0..65d4c37 100644
--- a/src/app/modules/home/play-quiz/play-quiz.component.ts
+++ b/src/app/modules/home/play-quiz/play-quiz.component.ts
@@ -15,9 +15,10 @@ export class PlayQuizComponent implements OnInit {
         private activatedRoute: ActivatedRoute,
         private router: Router,
         private cdr: ChangeDetectorRef
-    ) { }
+    ) {}
     isLoading: boolean = false;
     quiz: any = [];
+    idQuiz: any;
     actualQuestion: any;
     actualQuestionIndex: number = -1;
     score: number = 0;
@@ -25,8 +26,8 @@ export class PlayQuizComponent implements OnInit {
     ngOnInit(): void {
         this.isLoading = true;
         this.activatedRoute.queryParams.subscribe((params) => {
-            const idQuiz = params['idQuiz'];
-            this.questionSerivce.getQuiz(idQuiz).subscribe({
+            this.idQuiz = params['idQuiz'];
+            this.questionSerivce.getQuiz(this.idQuiz).subscribe({
                 next: (data: any) => {
                     this.quiz = data;
                     this.quiz.Question;
@@ -43,7 +44,6 @@ export class PlayQuizComponent implements OnInit {
         return textArea.value;
     }
 
-
     nextQuestion() {
         if (this.actualQuestionIndex === this.quiz.questionIndex - 1 + this.quiz.questions.length - 1) {
             Swal.fire({
-- 
GitLab