From 3451673162bae0bb6f92d883ed3a89b30faa73b4 Mon Sep 17 00:00:00 2001 From: Yoan VALLET <ext.sopra.yvallet@grandlyon.com> Date: Mon, 1 Mar 2021 15:20:57 +0100 Subject: [PATCH] update custom question --- docs/ecolyo/functionalities/challenge.md | 72 +++++++++++++++++++----- 1 file changed, 57 insertions(+), 15 deletions(-) diff --git a/docs/ecolyo/functionalities/challenge.md b/docs/ecolyo/functionalities/challenge.md index 41f0d10..1c5fd1a 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. -- GitLab