Skip to content
Snippets Groups Projects
Commit 6ce9a6bf authored by HAUTBOIS Aurelie's avatar HAUTBOIS Aurelie
Browse files

update quiz section

parent 6ebdf664
No related branches found
No related tags found
No related merge requests found
Pipeline #12377 passed
......@@ -4,6 +4,21 @@ This section explain all the functionnalities in the challenge part
A quiz includes 4 basic questions and one custom question.
### Process
Questions and answers are generated in random order.
At the begining of the quiz, the user have to select an answer and click validate.
Then, he sees the right answer and a modal with the explanation. After this modal, he goes to the next question.
Depending on the answer, the question result state is set either to correct or incorrect.
If it is a right answer, the quiz result is incremented by one.
A user can stop during a quiz and picks up where he left off. To define where the user left off, we have to check if at least one of the question result status is unlocked.
Once the custom question is answered, the quiz state is set to done. Then, the user sees his result and his earned stars. He can also retry or go back to the challenge page.
### Basic Question
All basics Questions are created in the quizEntity.json. We have to add :
......@@ -15,15 +30,6 @@ All basics Questions are created in the quizEntity.json. We have to add :
| description | Explains the question |
| source | Source of the explanation |
This questions and answers are in random order.
In the question page the user have to select an answer and click validate.
Then, he sees the right answer and a modal with the explanation and the source. After this modal, he goes to the next question.
Depending on the answer, the question result state is set either to correct or incorrect.
If it is a right answer, the quiz result is incremented by one.
### Custom Question
At the end of every quiz, we're creating a custom question.
......@@ -38,7 +44,7 @@ Here are the fields used to create a custom question
| singleFluid | boolean | Indicate if all connected fluid should be taken into account.<br/>If set to true only the first connected fluid will be taken into account in this order: electricity, gas, water. #unit and #fluid in the question label will be replace by the unit and the name of the fluid |
| result | UserQuizState | Indicate the state of the custom question (UNLOCKED, CORRECT, UNCORRECT) |
Calculation of custom question is done by conbinaison of all parameters:
Calculation of custom question is done by combination of all parameters:
#### Type DATE
......@@ -46,36 +52,36 @@ Calculation of custom question is done by conbinaison of all parameters:
Retrieve the **date** of day/month/year (define by _timeStep_) from the last week, month, year (define by _interval_).
```
example: What day did I consumme the most on the last week ?
type = CustomQuestionType.DATA
timeStep = TimeStep.DAY
interval = TimeStep.WEEK
period = {}
singleFluid = false
```
```
example: What day did I consumme the most #fluid in #unit on the last week ?
type = CustomQuestionType.DATA
timeStep = TimeStep.DAY
interval = TimeStep.WEEK
period = {}
singleFluid = true
```
```
example: What day did I consumme the most on the last week ?
type = CustomQuestionType.DATA
timeStep = TimeStep.DAY
interval = TimeStep.WEEK
period = {}
singleFluid = false
```
```
example: What day did I consumme the most #fluid in #unit on the last week ?
type = CustomQuestionType.DATA
timeStep = TimeStep.DAY
interval = TimeStep.WEEK
period = {}
singleFluid = true
```
- If _period_ is not empty
Retrieve the **date** of day/month/year (define by _timeStep_) from a week, month, year (define by _interval_) of _period_
```
example: What month did I consumme the most on year 2020 ?
type = CustomQuestionType.DATA
timeStep = TimeStep.MONTH
interval = TimeStep.YEAR
period = { year: 2020 }
singleFluid = false
```
```
example: What month did I consumme the most on year 2020 ?
type = CustomQuestionType.DATA
timeStep = TimeStep.MONTH
interval = TimeStep.YEAR
period = { year: 2020 }
singleFluid = false
```
#### Type MAXLOAD
......@@ -109,48 +115,55 @@ singleFluid = false
- If _period_ is empty
Retrieve the **average** of day/month/year (define by _timeStep_) from the last week, month, year (define by _interval_).
Retrieve the **average** of day/month/year (define by _timeStep_) from the last week, month, year (define by _interval_).
```
example: Which is your daily average consumption on last week ?
type = CustomQuestionType.AVERAGE
timeStep = TimeStep.DAY
interval = TimeStep.WEEK
period = {}
singleFluid = false
```
```
example: Which is your daily average consumption on last week ?
type = CustomQuestionType.AVERAGE
timeStep = TimeStep.DAY
interval = TimeStep.WEEK
period = {}
singleFluid = false
```
- If _period_ is not empty
- If _period_ is not empty
Retrieve the **average** of day/month/year (define by _timeStep_) from a week, month, year (define by _interval_) of _period_
Retrieve the **average** of day/month/year (define by _timeStep_) from a week, month, year (define by _interval_) of _period_
```
example: Which is your daily average consumption on january 2020 ?
type = CustomQuestionType.AVERAGE
timeStep = TimeStep.DAY
interval = TimeStep.MONTH
period = { month: 1, year: 2020 }
singleFluid = false
```
```
example: Which is your daily average consumption on january 2020 ?
type = CustomQuestionType.AVERAGE
timeStep = TimeStep.DAY
interval = TimeStep.MONTH
period = { month: 1, year: 2020 }
singleFluid = false
```
- If _period_ is weekday
- If _period_ is weekday
Retrieve the **average** of the _weekday_ from a week, month, year (define by _interval_).
Retrieve the **average** of the _weekday_ from a week, month, year (define by _interval_).
```
example: Which is your daily average consumption on wednesdays of last month?
type = CustomQuestionType.AVERAGE
timeStep = TimeStep.DAY
interval = TimeStep.MONTH
period = { weekday: 3 }
singleFluid = false
```
```
example: Which is your daily average consumption on wednesdays of last month?
type = CustomQuestionType.AVERAGE
timeStep = TimeStep.DAY
interval = TimeStep.MONTH
period = { weekday: 3 }
singleFluid = false
```
Then, two randoms answers are generated after defining the right answer.
#### Wrong answers
A user can stop during a quiz and picks up where he left off. To define where the user left off, we have to check if at least one of the question result status is unlocked.
After defining the right answer, two randows answers are generated depending of the custom question type:
Once the custom question is answered, the quiz state is set to done. Then, the user sees his result and his earned stars. He can also retry or go back to the challenge page.
- type DATE
Two dates is generated one, a day before the correct date and the other, a day after.
- type MAXLOAD or AVERAGE
Two random value is generated by applying a coefficient based on the correct answer.
This coefficient is randomly included between 0.7 and 0.9 (for the first value) or between 1.1 and 1.3 (for the second value)
## Exploration
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment