From f538dc26cf312ea7be3b7975cd6876127eeff0b1 Mon Sep 17 00:00:00 2001 From: Diego Villanueva <98838739+UO283615@users.noreply.github.com> Date: Sun, 7 Apr 2024 18:25:14 +0200 Subject: [PATCH 1/5] chore: Removed prints --- api/src/main/java/lab/en2b/quizapi/game/GameService.java | 3 --- 1 file changed, 3 deletions(-) diff --git a/api/src/main/java/lab/en2b/quizapi/game/GameService.java b/api/src/main/java/lab/en2b/quizapi/game/GameService.java index 39704e44..e3e47e66 100644 --- a/api/src/main/java/lab/en2b/quizapi/game/GameService.java +++ b/api/src/main/java/lab/en2b/quizapi/game/GameService.java @@ -60,9 +60,6 @@ public GameResponseDto answerQuestion(Long id, GameAnswerDto dto, Authentication Game game = gameRepository.findByIdForUser(id, userService.getUserByAuthentication(authentication).getId()).orElseThrow(); game.answerQuestion(dto.getAnswerId(), questionRepository); - System.out.println("Current round: " + game.getActualRound()); - System.out.println("Total round: " + game.getRounds()); - if (game.isLastRound()){ game.setGameOver(true); gameRepository.save(game); From d51afdf8ba28bffd475955e0178074f076e5e0b2 Mon Sep 17 00:00:00 2001 From: Diego Villanueva <98838739+UO283615@users.noreply.github.com> Date: Sun, 7 Apr 2024 18:26:11 +0200 Subject: [PATCH 2/5] Chore: Updated the model --- docs/src/08_concepts.adoc | 56 +++++++++++++++++++-------------------- 1 file changed, 28 insertions(+), 28 deletions(-) diff --git a/docs/src/08_concepts.adoc b/docs/src/08_concepts.adoc index bb47d5c3..22230c6a 100644 --- a/docs/src/08_concepts.adoc +++ b/docs/src/08_concepts.adoc @@ -9,23 +9,18 @@ This is the first version of the diagram, it will be updated if needed. [plantuml,"ConceptsDomainModel1",png] ---- @startuml - enum QuestionCategory { - HISTORY GEOGRAPHY - SCIENCE - MATH - LITERATURE - ART SPORTS + MUSIC } -enum AnsswerCategory { - CITY +enum AnswerCategory { + CAPITAL_CITY COUNTRY - PERSON - DATE - OTHER + SONG + STADIUM + BALLON_DOR } enum QuestionType{ @@ -39,44 +34,49 @@ class Question{ answers: List correctAnswer: Answer questionCategory: QuestionCategory - answerCategory: AnswerCategory - language: String - QuestionType: Type + type: QuestionType + games: List } class User{ username: String email: String password: String - answeredQuestions: int + role: String + games: List } -class UserStat{ +class Statistics{ + correct: Long + wrong: Long + total: Long + user: User } class Answer { text: String category: AnswerCategory - questionsWithThisAnswer: List - + language: String } class Game { user: User questions: List + rounds: int + actualRound: int + correctlyAnsweredQuestions: int + language: String + roundStartTime: LocalDateTime + roundDuration: Integer + currentQuestionAnswered: boolean + isGameOver: boolean } -class Ranking << Singleton >> { - -} - -User o--> Question -User "1" --> "1" UserStat -Game o--> Question -Game "n" --> "n" User -Question "n" --> "n" Answer -Ranking "1" --> "n" User +User "1"--"1" Statistics +Game "n"--"n" Question +Game "1" -- "n" User +Question "n" -- "n" Answer @enduml ---- From 8732d465f1b4dd76a65b597449e136d7d87be220 Mon Sep 17 00:00:00 2001 From: Diego Villanueva <98838739+UO283615@users.noreply.github.com> Date: Sun, 7 Apr 2024 18:33:55 +0200 Subject: [PATCH 3/5] Docs: Changed the DB to validate instead of create --- api/src/main/resources/application.properties | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/api/src/main/resources/application.properties b/api/src/main/resources/application.properties index 8f7af9da..1d2d87c7 100644 --- a/api/src/main/resources/application.properties +++ b/api/src/main/resources/application.properties @@ -1,6 +1,6 @@ JWT_EXPIRATION_MS=86400000 REFRESH_TOKEN_DURATION_MS=86400000 -spring.jpa.hibernate.ddl-auto=create +spring.jpa.hibernate.ddl-auto=validate spring.datasource.url=${DATABASE_URL} spring.datasource.username=${DATABASE_USER} spring.datasource.password=${DATABASE_PASSWORD} @@ -9,4 +9,4 @@ springdoc.swagger-ui.path=/swagger/swagger-ui.html springdoc.api-docs.path=/swagger/api-docs management.endpoints.web.exposure.include=prometheus -management.endpoint.prometheus.enabled=true \ No newline at end of file +management.endpoint.prometheus.enabled=true From b889c6d95891d782f7521dc6f5735df45491ea57 Mon Sep 17 00:00:00 2001 From: Diego Villanueva <98838739+UO283615@users.noreply.github.com> Date: Sun, 7 Apr 2024 18:34:53 +0200 Subject: [PATCH 4/5] Docs: Updated the game definition --- docs/src/08_concepts.adoc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/08_concepts.adoc b/docs/src/08_concepts.adoc index 22230c6a..2fe77cb0 100644 --- a/docs/src/08_concepts.adoc +++ b/docs/src/08_concepts.adoc @@ -86,7 +86,7 @@ Question "n" -- "n" Answer | Question | The model of the questions, has a type to specify if it is text, image or audio. Stores both right and wrong answers | User | The people using the application, they have statistics and take part in a ranking to compete | Answer | Models each possible answer, created to reuse answers that are common to different questions, as well as distractors -| Game | It is created when the user starts a game and destroyed just when it ends. +| Game | It is created when the user starts a game and includes the rounds that the user has to answer |=== .Architecture and design patterns From 66db64316ecba5fcbeeaa907ea945a45f71bc685 Mon Sep 17 00:00:00 2001 From: Diego Villanueva <98838739+UO283615@users.noreply.github.com> Date: Sun, 7 Apr 2024 18:57:11 +0200 Subject: [PATCH 5/5] Docs: Cross cutting concepts updated --- docs/src/08_concepts.adoc | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/src/08_concepts.adoc b/docs/src/08_concepts.adoc index 2fe77cb0..743e5634 100644 --- a/docs/src/08_concepts.adoc +++ b/docs/src/08_concepts.adoc @@ -89,6 +89,13 @@ Question "n" -- "n" Answer | Game | It is created when the user starts a game and includes the rounds that the user has to answer |=== +.Question Generator +The Question Generator is an important part of our application, it is already briefly described in Section 6, but mopre insight is given here. + +The Question Generator module is written in Java and connects via HTTP with Wikidata query service. +It follows a template design pattern where each Java class is responsible for generating the questions and answers. +The query is ran against Wikidata and it returns a text in JSON format that is processed into the question and answers, which are later stored in the DB. + .Architecture and design patterns We decided to use a React based frontend with BootSpring for the backend, which will follow the model view controller pattern to make the code clear.