From dd179b6a4505ca42dd7a25a1bdf5d502f9b97101 Mon Sep 17 00:00:00 2001
From: GOEPP THOMAS <thomas@saturne-digital.fr>
Date: Mon, 13 Jan 2025 22:26:54 +0100
Subject: [PATCH] refactor: show good values

---
 components/lists/QuizList.tsx | 7 +++++--
 models/Quiz.ts                | 7 +++++++
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/components/lists/QuizList.tsx b/components/lists/QuizList.tsx
index 535915f..dfad0f6 100644
--- a/components/lists/QuizList.tsx
+++ b/components/lists/QuizList.tsx
@@ -41,11 +41,14 @@ interface Props {
     onQuizPressed:(quiz: Quiz) => void;
 }
 export default function QuizList({ quizList, isLoadingData, nextPage, onQuizPressed }: Props) {
+    if (quizList) {
+        console.log(quizList[0]);
+    }
     const renderQuizItem = ({ item }: { item: Quiz }) => (
         <TouchableOpacity style={styles.quizItem} onPress={() => onQuizPressed(item)}>
-            <Text style={styles.quizTitle}>{item.id}</Text>
+            <Text style={styles.quizTitle}>{item.name}</Text>
             <Text style={styles.quizDetails}>
-                {item.questionCount} QUESTIONS | {item.category ? item.category.name.toUpperCase() : ""}
+                {item.questionCount} QUESTIONS | {item.difficulty.name} | {item.author.username}
             </Text>
         </TouchableOpacity>
     );
diff --git a/models/Quiz.ts b/models/Quiz.ts
index c717243..83a6284 100644
--- a/models/Quiz.ts
+++ b/models/Quiz.ts
@@ -13,6 +13,12 @@ export interface Category {
     name: string;
 }
 
+interface Author {
+    id: number;
+    username: string;
+}
+
+
 export interface Quiz {
     id: string;
     name: string;
@@ -22,6 +28,7 @@ export interface Quiz {
     questionCount: number;
     categoryId: number;
     difficultyId: number;
+    author: Author,
     authorId: number,
     category?: Category,
     difficulty: Difficulty,
-- 
GitLab