From aa7505f05daccfb31eae78b71b089d98d23645d6 Mon Sep 17 00:00:00 2001 From: tomivt Date: Fri, 28 Mar 2025 09:37:54 +0100 Subject: [PATCH] feat: Quick fix on QuizRandom --- .../com/example/what_the_fantasy/data/local/QuestionStub.kt | 4 +--- .../com/example/what_the_fantasy/ui/screens/QuizEndPage.kt | 2 +- .../com/example/what_the_fantasy/ui/screens/QuizRandom.kt | 2 +- 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/local/QuestionStub.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/local/QuestionStub.kt index 317518c..b786637 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/local/QuestionStub.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/data/local/QuestionStub.kt @@ -98,7 +98,5 @@ object QuestionStub { question1, question2, question3, question4, question5, question6, question7, question8, question9, question10 ) - val allQuestionsShuffled: List = listOf( - question1, question2, question3, question4, question5, question6, question7, question8, question9, question10 - ).shuffled() + val shuffleRandomQuestions: List = allQuestions.shuffled().take(10) } \ No newline at end of file diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuizEndPage.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuizEndPage.kt index cbd6c6d..74ffee1 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuizEndPage.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuizEndPage.kt @@ -84,7 +84,7 @@ fun QuizEndPage( textAlign = TextAlign.Center ) ) - val nbQuestions = QuestionStub.allQuestionsShuffled.size + val nbQuestions = 10 Text( text = "Nombres de Questions : $nbQuestions", color = Color.White, diff --git a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuizRandom.kt b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuizRandom.kt index b038774..e13b60b 100644 --- a/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuizRandom.kt +++ b/What_The_Fantasy/app/src/main/java/com/example/what_the_fantasy/ui/screens/QuizRandom.kt @@ -30,7 +30,7 @@ fun QuizRandom( navSearch: () -> Unit, navControllerQuizEnd: (Int, Int) -> Unit, ) { - val questions = QuestionStub.allQuestionsShuffled + val questions = QuestionStub.shuffleRandomQuestions var idCurrentQuestion by remember { mutableIntStateOf(0) } var pts by remember { mutableIntStateOf(0) } var lifes by remember { mutableIntStateOf(3) }