Skip to content

Commit

Permalink
Merge pull request #191 from Arquisoft/docs/villanuevaDocu
Browse files Browse the repository at this point in the history
Updated the doc and little changes
  • Loading branch information
gony02 authored Apr 7, 2024
2 parents 117300c + 66db643 commit 223973e
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 34 deletions.
3 changes: 0 additions & 3 deletions api/src/main/java/lab/en2b/quizapi/game/GameService.java
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions api/src/main/resources/application.properties
Original file line number Diff line number Diff line change
@@ -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}
Expand All @@ -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
management.endpoint.prometheus.enabled=true
65 changes: 36 additions & 29 deletions docs/src/08_concepts.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand All @@ -39,44 +34,49 @@ class Question{
answers: List<Answer>
correctAnswer: Answer
questionCategory: QuestionCategory
answerCategory: AnswerCategory
language: String
QuestionType: Type
type: QuestionType
games: List<Game>
}
class User{
username: String
email: String
password: String
answeredQuestions: int
role: String
games: List<Game>
}
class UserStat{
class Statistics{
correct: Long
wrong: Long
total: Long
user: User
}
class Answer {
text: String
category: AnswerCategory
questionsWithThisAnswer: List<Question>
language: String
}
class Game {
user: User
questions: List<Question>
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
----
Expand All @@ -86,9 +86,16 @@ Ranking "1" --> "n" User
| 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
|===

.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.

Expand Down

0 comments on commit 223973e

Please sign in to comment.