# QuizDuel
###### tags: `Hublz` `RSA`
#### **1. Start Task**
* Does Sync happen before or after clicking artventure button? -> probably after, because clicking will trigger the sync message?
* Screen: Artventure Task

#### **2. Wait for Player**
* Screen: QuizLobby (Gui Parts: Timer, Icons for present groups)
* Logic: No interaction - automatic redirect if
* all groups present (do we know how many groups should be present?)
* or timer runs out (what if only one group present -> need to make sure the game is playable with a single group)
#### **3. QuizDuell Spiel Ablauf**
* Questions should not contain audio content -> listening, deciding, ... would take too long
--> No, questions **should** contain audio content
* Screen: QuizDuelPage should look like QuizPage
Additions to GUI:
* Timer (20 sec)
* ??
* Logic: **Can QuizPage be recycled? How much control do we need about the widgets?**
* Functionality that needs to be changed from quiz:
* On submit
-> don't display the explanation of correct answer
-> just display correct answer
-> when all groups answered go to intervention screen
* Scoring -> extra points if fastest group to answer? Whats the implementation of that? erst query ob shcon jemand geantwortet hat? was wenn in der zwischenzeit jemand antwortet? race conditions?
* Redirect to Intervention Screen only when all groups have answered?
#### **4. Interventions / Ergebnisscreen**
* Show current ranking of all groups after answering each question
* Screen: QuizDuelResultPage
ordered oder unordered?
* ordered:

* If groups have the same number of points, number in front should be same
* unordered

#### **5. Spiel abgeschlossen**
* Am Schluss einfach nochmal den Intervention Screen anzeigen? Oder designierter Screen mit Siegertreppchen oder so (müsste Grafikerin machen)
* For groups / artventure generally: Where are 'overall' points saved (across the whole artventure)? Is this already happening or will this be part of the group?
### Messaging
-> Realtime Firebase?
### Model @ Tobi
* WordCloud Settings: wer befüllt die? die User oder der Content creator? Weil ich dann für alle neuen Minigames Settings erstellt hätt, aber wenn ich bei QuizDuel die Anzahl der gruppen festleg, ist das sinnlos wenn die von den vom content creator kommen
* Wie funktioniert der JoinLink den du ins WordCloud model gegeben hast? -> bzgl infos in den controllern bekommen: wer ist subgroup leader, wie viele gruppen nehmen an einem spiel teil

## TODO
### refactor from quiz
- [x] or disable click while await?
- [x] handle button behaviour on intervention screen
- [x] Index issues when adding intervention screen (questions not correctly mapped, triggered all the time)
- [x] change text of button when intervention screen
- [x] where to update total index?
- [ ] how to deal with complete quiz? result.content == null, passt das so? dann handle on complete, wenn nicht setz des hoid
- [ ] should be completed before or after displaying ranking one last time?
### big parts
- [ ] DataModels
- [ ] Lobby and intervention screen GUI
- [ ] update Lobby and intervention based on group data
- [ ] add navigation logic based on groups (how to mock?)
### communication
firebase realtime db? if so, what is actually saved to firebase? Is it actually persisted?
messages that need to be sent to the db:
* entered lobby
* submitted answer
messages that need to be sent from db:
* all entered lobby
* all submitted answer
For sync messages:
The DB is a firebase DB right? Is it a realtime db?
Because my current plan for synching is to have another table that looks like this:
```json
QuizSyncMessage{
id: string,
creation_date: long, //unix millis
type: enum {
'entered_lobby',
'submitted_answer'
},
questionIndex?: int,
groupId: string,
userId: string //either userId or subgroupId?
}
```
Do you have a similar plan for the group feature? Should this be more generic so we can use the same table?