diff --git a/docs/ecolyo/functionalities/challenge.md b/docs/ecolyo/functionalities/challenge.md index 41f0d100829c039c3e081429d9a917b45b05f33c..1c5fd1aef3bfe846cd1a4d54967f6707e0b368f0 100644 --- a/docs/ecolyo/functionalities/challenge.md +++ b/docs/ecolyo/functionalities/challenge.md @@ -27,10 +27,10 @@ Here are the fields used to create a custom question | 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. | +| type | CustomQuestionType | Type of custom qusetion: DATA or MAXLOAD or AVERAGE. | +| timeStep | TimeStep | Time step of the result value (DAY / WEEK / MONTH / YEAR). For MAXLOAD or AVERAGE type, it represents 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) | +| period | CustomPeriod | Case day / month / year:<br/>Use to define a specific period for the interval { day? / month? / year? }. <br/>Case weekday:<br/>Only usable with AVERAGE type and DAY timestep: Allow to specify a weekday on which average is made. If used with another type, period will not be taken into account.<br/>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: @@ -39,42 +39,84 @@ Calculation of custom question is done by conbinaison of all parameters: - 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 ? + 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 = {} + ``` - 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 ? + 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} + period = { year: 2020 } + ``` -- Type CALCULATION +- Type MAXLOAD + + - If *period* is empty + + Retrieve the **maxload** value of day/month/year (define by *timeStep*) from the last week, month, year (define by *interval*). + ``` + example: Which is your daily max consumption on the last week ? + type = CustomQuestionType.MAXLOAD + timeStep = TimeStep.DAY + interval = TimeStep.WEEK + period = {} + ``` + + - If *period* is not empty + + Retrieve the **maxload** value of day/month/year (define by *timeStep*) from a week, month, year (define by *interval*) of *period* + ``` + example: Which is your daily max consumption on january 2020 ? + type = CustomQuestionType.MAXLOAD + timeStep = TimeStep.DAY + interval = TimeStep.MONTH + period = { month: 1, year: 2020 } + ``` + +- Type AVERAGE - 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 + ``` + example: Which is your daily average consumption on last week ? + type = CustomQuestionType.AVERAGE 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 + 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} + period = { month: 1, year: 2020 } + ``` + - If *period* is weekday + + 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 } + ``` Then, two randoms answers are generated after defining the right answer.