diff --git a/docs/ecolyo/functionalities/challenge.md b/docs/ecolyo/functionalities/challenge.md index 243a255884e56c0d39302eca43e683be9087188e..41f0d100829c039c3e081429d9a917b45b05f33c 100644 --- a/docs/ecolyo/functionalities/challenge.md +++ b/docs/ecolyo/functionalities/challenge.md @@ -22,13 +22,61 @@ 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. During the creation of the quiz, we have to add : +At the end of every quiz, we're creating a custom question. +Here are the fields used to create a custom question -- type => data or calculation -- period => the period selected for the calcul -- timestep => the interval of the calcul (Day, Month, Year) - We get all this information to determine the custom question (All information are in the quizEntity.json). Depending of the question type, the system calcul a maximum or an average data. - Then, he generate two randoms answers following the right answer. +| Field | Type | Description | +| ---------- | ------------------ | ---------------------------------------------------------------- | +| type | CustomQuestionType | Type of custom qusetion: DATA or CALCULATION. | +| timeStep | TimeStep | Time step of the result value (DAY / WEEK / MONTH / YEAR). For CALCULATION type it's represent daily / weekly / monthly / yearly average. | +| interval | TimeStep | Interval in which the data will be searched (DAY / WEEK / MONTH / YEAR) | +| period | CustomPeriod | Use to define a specific period for the interval { day? / month? / year? }. If not assigned the period will be the last interval (example: last week) | +| result | UserQuizState | Indicate the state of the custom question (UNLOCKED, CORRECT, UNCORRECT) | + +Calculation of custom question is done by conbinaison of all parameters: + +- Type DATA + + - If *period* is empty. + + Retrieve the *max load* 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 = {} + + - If *period* is not empty + + Retrieve the **max load** of day/month/year (define by *timeStep*) from 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} + +- Type CALCULATION + + - If *period* is empty + + 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.CALCULATION + timeStep = TimeStep.DAY + interval = TimeStep.WEEK + period = {} + + - If *period* is not empty + + Retrieve the *average* of day/month/year (define by *timeStep*) from week, month, year (define by *interval*) of *period* + => example: Which is your daily average consumption on january ? + type = CustomQuestionType.DATA + timeStep = TimeStep.DAY + interval = TimeStep.MONTH + period = {month: 1} + + +Then, two randoms answers are generated after defining the right answer. 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.