From 12ee5a4d6fde080f5bd6b859dc419c69bc7a35fe Mon Sep 17 00:00:00 2001
From: "guilhem.carron" <gcarron@grandlyon.com>
Date: Tue, 25 Jan 2022 16:18:35 +0100
Subject: [PATCH] feat: Add doc for new ecogesture + edit enedis half hour
 service

---
 docs/ecolyo/application/redux.md              |  4 +-
 docs/ecolyo/functionalities/ecogesture.md     | 63 ++++++++++++++++---
 .../enedis_halfhour_monthly_analysis.md       |  4 +-
 3 files changed, 59 insertions(+), 12 deletions(-)

diff --git a/docs/ecolyo/application/redux.md b/docs/ecolyo/application/redux.md
index 8a04bd6..438e463 100644
--- a/docs/ecolyo/application/redux.md
+++ b/docs/ecolyo/application/redux.md
@@ -12,7 +12,9 @@ For a better state management, combineReducers(reducers) is used to split the re
 | Reducer   | Type           | Description                                                                                                                                                                                                                                                                                                                                                                    |
 | --------- | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
 | global    | GlobalState    | store global states such as: notification, type device or fluid type<br><br>GlobalState enum<br>- _screenType = ScreenType_<br>- _challengeExplorationNotification = boolean_<br>_releaseNotes = ReleaseNotes_<br>_termsStatus = TermsStatus_<br>_openPartnersIssueModal = boolean_<br>- _challengeActionNotification = boolean_<br>- _challengeDuelNotification = boolean_<br>- _analysisNotification = boolean_<br>- _fluidStatus = FluidStatus[]_<br>- _fluidTypes = FluidType[]_ |
-| profile   | Profile        | store states about profile information such as: notification, connectionDate, profileType                                                                                                                                                                                                                                                                                      |
+| profile   | Profile        | store states about profile information such as: notification, connectionDate 
+| profileType   | ProfileTypeState        | store states about user's profileType filled through the profile form 
+| profileEcogesture   | ProfileEcogestureState        | store states about user's profileEcogesture filled through the profile ecogesture form
 | chart     | ChartState     | store consumption chart states such as: timeStep, graph data<br><br>ChartState enum<br>- _selectedDate = DateTime_<br>- _currentTimeStep = TimeStep_<br>- _currentIndex = number_<br>- _currentDatachart = Datachart_<br>- _currentDatachartIndex = number_<br>- _loading = boolean_                                                                                           |
 | modal     | ModalState     | store opening state of the feedback modal <br><br>ModalState enum<br>- _isFeedbacksOpen = boolean_                                                                                                                                                                                                                                                                             |
 | challenge | ChallengeState | store challenge state such as: list of user challenge, data load and current challenge <br><br>ChallengeState enum<br>- _userChallengeList = UserChallenge[]_<br>- _currentChallenge = UserChallenge_<br>- _currentDataload = Dataload[]_                                                                                                                                      |
diff --git a/docs/ecolyo/functionalities/ecogesture.md b/docs/ecolyo/functionalities/ecogesture.md
index 0a9544f..44569b0 100644
--- a/docs/ecolyo/functionalities/ecogesture.md
+++ b/docs/ecolyo/functionalities/ecogesture.md
@@ -32,25 +32,70 @@ Ecogesture {
   actionDuration: number
   objective: boolean
   doing: boolean
+  viewedInSelection: boolean
 }
 ```
+## Ecogestures screen
+
+This screen is divided in 3 tabs : 
+- *ALL*: display the full list of ecogestures. User can filter ecogesture by usage.
+- *DOING*: display the list of doing ecogestures. User can filter ecogesture by usage.
+- *OBJECTIVES*: display the list of objectives ecogestures. User can filter ecogesture by usage.
+
+### RULES
+
+- By default the *ALL* tab is selected.
+- If user click on an ecogesture, he will see more information about it and will be able to choose manually if it is *doing* AND/OR *objective*
+- The back arrow button on a single ecogesture returns to the tab he came through.
 
 ### Ecogesture Status
 
-An ecogesture can have a status according the user's choice, it can be *doing* and/or *objective* which allows the user to consult them in the related tabs in the ecogesture page.
+An ecogesture can have a status according the user's choice, it can be *doing* and/or *objective* which allows the user to consult them in the related tabs in the ecogesture page. On it is selected by the user in the tinder-like tunnel, the *viewedInSelection* key is set to true, so the user won't see it again in its selection.
+
+## Profile Ecogesture
 
-### TODO: Add ecogesture selection rules 
+The first time the user consults the ecogesture page, he will be prompted to start selecting his custom ecogestures.
+- If he refuses, I will still be able to access this functionnality by clicking on the "Select" button on the tabs 'Doing' and 'Objectives' while they are still empty.
+- If he starts select ecogestures on his own by the tab 'All' and fill both 'objective' and 'doing' sections, he won't be able to access the form and selection as described in the next parts.
 
-## All ecogestures screen
+### Model
 
-This screen display the full list of ecogestures. User can filter ecogesture by usage.
+```
+ProfileEcogesture {
+  heating: IndividualOrCollective
+  warmingFluid: WarmingType | null
+  hotWater: IndividualOrCollective
+  equipments: EquipmentType[]
+}
+```
 
-## Ecogestures filtered by profile
+### Ecogesture Form
+The form is compose in 2 parts :
+- The first is made of question concerning his heating fluid and type (individual or collective), and his hotWater type.
+- The second part asks the user to pick the equipment he has.
 
-This screen display is based on a filtered ecogesture list that fit to the user profile type.
-The user can also filter ecogesture by usage.
+*If the user has completed his profileType, he won't see the first part as it is automatically completed with the information he filled in his profileType*
 
-Following rules are used to filter the ecogesture:
+- The first part filters his custom list by Usages ECS and HEATING
+- The second part filters his custom list by Equipments
+
+
+## Ecogesture Selection
+
+Once user has completed his profile ecogesture through the form, he has the possibility to enter the ecogesture selection (tinder-like)
+- A list of custom ecogesture is made according to his profile
+- User will cross this list 10 by 10, and has to choose if it is 'doing' 'objective' or 'not interested
+
+### Important Rules
+
+- If uses refuses to do the selection for now, he will be reminded to do it in the 'doing' and 'objective' tabs, and a continue button will show
+- User can go back and correct his answer at any time
+- User can stop the process at any time, hist answer will be saved ad the next time he will open the selection, a new stack of 10 ecogesture is made (for example, user stops at 4/10, the next time he opens the selection it will be 4/14)
+- If user chooses to select manually an ecogesture outside of the selection tunnel (through the 'all' tab), this ecogesture will be removed from the list it was existing in it.
+- If user chosses to remove manually an ecogesture outside of the selection tunnel (through the 'doing' and 'objective' tab), thoose ecogestures won't be purposes again in the selection tunnel.
+- User can't use the back arrow on the first ecogesture of selection list
+
+Once the whole process is done, the user has no possibility to do it again through the tinder-like selection, but he can still edit his ecogestures manually from the various tabs.
 
 ### Case ecogesture usage is heating
 
@@ -74,7 +119,7 @@ OR
 
 - the ecogesture has gas fluid and profile type has an individual hot water which use gas fluid.
 
-### Case ecogesture usage is ECS
+### Case ecogesture usage is Cooking
 
 We will display the ecogesture if:
 
diff --git a/docs/ecolyo/services/enedis_halfhour_monthly_analysis.md b/docs/ecolyo/services/enedis_halfhour_monthly_analysis.md
index 2a15fea..79295a5 100644
--- a/docs/ecolyo/services/enedis_halfhour_monthly_analysis.md
+++ b/docs/ecolyo/services/enedis_halfhour_monthly_analysis.md
@@ -49,7 +49,7 @@ weekEndValuesArray : [
 ```
 - Once the array is filled with all available values, we just have to calculate the average for each half-hour step
 
-- The **minimum value** is calculated by the *getMonthMinLoad* function, it takes the complete week and weekend values arrays as parameters and return the minimum value, excluding -1 (empty values), and 0 (null values).
+- The **minimum value** is calculated by the *getMonthMinLoad* function, it takes the complete week and weekend values arrays as parameters and return the minimum value, excluding -1 (empty values), and 0 (null values). This value is multiplicated with 48 (the number of half hour entries in a day) and with the number of days in the month.
 - The **maxPower** value is fetched from the doctype *com.grandlyon.enedis.maxpower*, the value is stored on a daily basis, so take the maximum value for the given month.
 - The result is stored in *com.grandlyon.enedis.monthly.analysis.data* according to the following model : 
 
@@ -57,7 +57,7 @@ weekEndValuesArray : [
 EnedisMonthlyAnalysisData {
   weekDaysHalfHourAverageValues: number[]
   weekEndDaysHalfHourAverageValues: number[]
-  minLoad: number
+  minimumLoad: number
   maxPower: number
   month: number
   year: number
-- 
GitLab