diff --git a/docs/ecolyo-agent/Technical/handle_assets.md b/docs/ecolyo-agent/Technical/handle_assets.md index e89cbd830db804b47c455846182428269d741c82..25ee707fc23a368af0eda4fd3c1af89950fc124a 100644 --- a/docs/ecolyo-agent/Technical/handle_assets.md +++ b/docs/ecolyo-agent/Technical/handle_assets.md @@ -43,7 +43,17 @@ curl https://forge.grandlyon.com/api/v4/projects/621/jobs/artifacts/master/downl > This command fetches the latest artifact for the **import-convert-assets** job -- Extract and overwrite current assets `unzip -o image-lib.zip` +:::warning Artifact not found + +If the link above downloads an empty archive, you can find the link to the assets on https://forge.grandlyon.com/web-et-numerique/factory/llle_project/backoffice-server/-/artifacts under the pipeline "import-convert-assets" and file name `artifacts.zip` + +::: + +- Extract and overwrite current assets + +```sh +unzip -o image-lib.zip +``` If everything is successful you can go to the assets folder to check your updated images : diff --git a/docs/ecolyo/Functionalities/analysis.md b/docs/ecolyo/Functionalities/analysis.md index 8a867f2f4ef147b55524c6886202efa0a302ceee..3ee5075c29739c8e9bcf08812f9c23b331dc64c5 100644 --- a/docs/ecolyo/Functionalities/analysis.md +++ b/docs/ecolyo/Functionalities/analysis.md @@ -18,6 +18,24 @@ Par exemple, le 3 juin, un utilisateur pourra voir son analyse de Mai. Les utilisateurs ne seront pas bloqués pour naviguer dans les dates précédentes, et s'il n'y a pas d'analyse à afficher, nous affichons des tirets à la place des données. +## Bloc rappel inscription à la newsletter + +Depuis la version 3.1.0 d'Ecolyo, l'inscription à la newsletter est facultative lors de la création du compte. Ce bloc permet de rappeler aux utilisateurs de s'inscrire à la newsletter. + + + +### Interactions + +Si l'utilisateur clique sur la croix, le message disparaît jusqu'au rechargement de l'application. Pour cela on met à jour la variable `haveSeenNewsletterReminder` à `true` dans le store de l'analyse. Celle-ci est initialisée à `false` lors du chargement de l'application. + +Si l'utilisateur clique sur le bouton "Je m'inscris", il est inscrit à la newsletter et le message disparaît. Pour cela on met à jour la variable `sendAnalysisNotification` à `true` dans le profil de l'utilisateur. + +Si l'utilisateur clique sur le bouton "Ne plus afficher", le message ne s'affichera plus jamais. Pour cela on met à jour la variable `isAnalysisReminderEnabled` à `false` dans le profil de l'utilisateur. Celle-ci est initialisée à `true` lors de la migration de l'application en version 3.1.0. + +### Affichage + +Le message est affiché en haut de l'écran, uniquement si l'utilisateur n'est pas déjà inscrit à la newsletter et qu'il n'a pas déjà fermé ce message durant la session ET qu'il n'a pas encore cliqué sur le bouton "Ne plus afficher". + ## Bloc Comparaison avec mois précédent ou année précédente Ce bloc est divisé en deux parties, une première concernant la température moyenne et l'autre la consommation. diff --git a/docs/ecolyo/Functionalities/dacc.md b/docs/ecolyo/Functionalities/dacc.md index c507d99a988561202fd4d034193491c73a2ef15c..b9960f621519e62257eb7b32a98654935a965dd4 100644 --- a/docs/ecolyo/Functionalities/dacc.md +++ b/docs/ecolyo/Functionalities/dacc.md @@ -51,7 +51,7 @@ All monthly indicators call can be found after this comment on the code | Indicator | Trigger | value | | ------------------------------ | ----------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | consumption-variation-monthly | Tous les mois si l'utilisateur a été connecté au moins une fois dans le mois | La variation de consommation par type de fluide. Les paramètres différents sont le type de profil ainsi que le nombre de mois entre la première connexion de l'utilisateur et le moment où est remonté l'indicateur (seniority) | -| summary-subscription-monthly | Tous les mois si un utilisateur a souscrit a la newsletter ou c'est désabonné | 1 si l’utilisateur est inscrit sinon 0 | +| summary-subscription-monthly | Tous les mois si un utilisateur a souscrit a la newsletter ou s'est désabonné | 1 si l’utilisateur est inscrit sinon 0 | | fluid-data-granularity-monthly | Tous les mois sans condition | 1 si l'utilisateur possède de la donnée a la demi heure sur le mois. Sinon 0 | | profile-count-monthly | Tous les mois si le profil a été complété au moins une fois | Le nombre de fois ou le profile a été complété | diff --git a/docs/ecolyo/Functionalities/prices.md b/docs/ecolyo/Functionalities/prices.md index 1c54edc46323db2f5a326a33b54b65d63e08073a..660bac1884f569ff3d68292aeb161d2e3c8b76ef 100644 --- a/docs/ecolyo/Functionalities/prices.md +++ b/docs/ecolyo/Functionalities/prices.md @@ -9,102 +9,47 @@ Since version `1.6.0` of the app, we have a database storing fluid prices evolut - Electricity - Gas -Before this version, the app was applying a hard coded price for each fluid without taking care of the time period. Now, there is a service that processes fresh data in order to apply the current price to this data, but also apply the most relevant price for a fluid doctype. +Before this version, the app was applying a hard coded price for each fluid without taking care of the time period. Now, there is a service updating the database with the most relevant price for a fluid doctype. **The connectors are responsible for the calculation of the price.** ## Service ### Process -The Cozy service responsible for price calculation is `fluidsPrices`. You can find the full logic in the following diagram : +The Cozy service responsible for updating prices is `fluidsPrices`. You can find the full logic in the following diagram : ```plantuml @startuml scale 0.8 start -repeat :Select Price (Elec, gas); -:Apply Prices on selected price; - -if (There is prices in database) then (true) - :Get oldest data without price; - if (There is a doctype without price) then (Process price) - :Take founded date as time reference; - if (FluidType is elec) then (true) - repeat - :Get half-hour data by day (48 elements); - :Get price for the period; - :Apply price on each element; - :Save all elements; - :Increment date by one day; - repeat while (Date is not today) - else (false) +repeat :For each fluid (elec, water, gas); + :Get prices from backoffice; + + repeat :for each price + if (price is in database?) then (yes) + if (price is outdated?) then (yes) + :Update price; + else (no) endif - repeat - :Get daily data by month (max 31 elements); - :Get price for the period; - :Apply price on each element; - :Save all elements; - :Increment date by one month; - repeat while (Date is not in current month) - :Start aggregation for month and year; - repeat - :Get daily data by month (max 31 elements); - :Get monthly data without price (1 element); - :Sum prices for all daily elements; - :Add price on monthly data doc; - :Save monthly element; - :Increment date by one month; - repeat while (Date is not in current month) - repeat - :Get monthly data by year (max 12 elements); - :Get yearly data without price (1 element); - :Sum prices for all monthly elements; - :Add price on yearly data doc; - :Save yearly element; - :Increment date by one year; - repeat while (Date is not in current year) - else (Stop service) - :Log error and stop process; - end - endif -else (Stop service) - :Log error and stop process; - end -endif - - -repeat while (All fluid are not processed) + else (no) + :Save price; + endif + repeat while (Next price) + ->no more price; -stop +repeat while (Next fluid) +->no more fluid; +stop @enduml ``` -This service is running every night at 02:00 AM and during splash screen. - -:::warning - -You might observe some price miscalculation because the service is triggered asynchronously during splash root, but because of the default price in `constants/config.json`, the user should not see a big difference. - -::: - -### Init - -A migration job has been setup to init the database with json data store inside the app. This job should be run once and will init electricity and gas prices. +This service is running every morning before 7:00 AM. ### New price -In case of price update the following procedure must be done : - -- Create a migration for adding new prices -- Update hard coded price inside app in order to maintain fallback calculation -- Verify full service calculation with new data -- Verify calculation with existing data - -:::warning -The service does not handle change during a month because the case does not exist anymore for Enedis and Grdf. -::: +In case of price update or new price, simply add a new price in the backoffice and the service will take care of the rest. ### Prices Data @@ -134,7 +79,7 @@ The app take the hard code price for a given fluid and apply it to a load. This In a shell run a build and test service with le following command line : ```bash -yarn build-dev:browser; yarn run cozy-konnector-dev -m .\manifest.webapp .\build\services\monthlyReport\ecolyo.js +yarn build-dev:browser; yarn run cozy-konnector-dev -m .\manifest.webapp .\build\services\fluidsPrices\ecolyo.js ``` ### Future Changes diff --git a/docs/ecolyo/Functionalities/terms.md b/docs/ecolyo/Functionalities/terms.md index 5be6e72387990c5101105625be0d24af4f00c151..68dd23c3cc9392a2a3d5944d541c40f6380c732f 100644 --- a/docs/ecolyo/Functionalities/terms.md +++ b/docs/ecolyo/Functionalities/terms.md @@ -4,7 +4,7 @@ This section explains the way we handle terms in the application. ## Description -The terms version is handled with the _io.cozy.terms_ doctype. It is incremented each time we edit the CGU, the data consent validation or the legal notices. Once we increment the terms version, the user will be prompted to accept these terms, otherwise we won't be able to access the app. +The terms version is handled with the *io.cozy.terms* doctype. It is incremented each time we edit the CGU, the data consent validation or the legal notices. Once we increment the terms version, the user will be prompted to accept these terms, otherwise we won't be able to access the app. ### Private Routes @@ -12,16 +12,18 @@ All routes are private, and are accessible only if the user has accepted the las The only public routes are : -- _/terms_ : shows the terms validation page, and is the main page the user is redirected to if his consent is outdated -- _/cgu_ : shows the CGU public page, accessible by the terms page -- _/legal_ : shows the Legal Notice public page, accessible by the terms page +- */terms* : shows the terms validation page, and is the main page the user is redirected to if his consent is outdated +- */cgu* : shows the CGU public page, accessible by the terms page +- */legal* : shows the Legal Notice public page, accessible by the terms page ### Terms management We check the terms acceptation in the **splash screen** while the application is initializing, if there is no consent (first connection), or the consent is outdated (update of terms), the user will be redirected to the terms acceptation page. -For the full terms acceptation process, the user has to check the two checkboxes (one for Data share consent, and one for CGU and Legal Notice) to unlock the terms acceptation button. Once he has accepted it, a new term doctype is created with the value _accepted_ to true. So he can access now the entire application. -We store in user's profile a boolean _showConsentModal_ that allows the app to know about the consent status. +For the full terms acceptation process, the user has to check the two checkboxes (one for Data share consent, and one for CGU and Legal Notice) to unlock the terms acceptation button. Once he has accepted it, a new term doctype is created with the value *accepted* to true. So he can access now the entire application. +We store in user's profile a boolean *showConsentModal* that allows the app to know about the consent status. + +If the user is not subscribed to the newsletter, a third facultative checkbox is displayed. If the user checks it, he will be subscribed to the newsletter. If there is a consent update, two cases are possible : diff --git a/docs/ecolyo/Technical/Services/enedis_halfhour_monthly_analysis.md b/docs/ecolyo/Technical/Services/enedis_halfhour_monthly_analysis.md index 58141a3dc48589da70808072610d82b42e7cb1bb..4ec2935e6ad14502eda3a33b0ad8fda221917805 100644 --- a/docs/ecolyo/Technical/Services/enedis_halfhour_monthly_analysis.md +++ b/docs/ecolyo/Technical/Services/enedis_halfhour_monthly_analysis.md @@ -1,12 +1,12 @@ # Enedis half-hour monthly analysis -The service will run everyday 3rd of month at 8.00 am, as defined in the manifest: +The service will run everyday 3rd of month between 10am and 12pm (noon), as defined in the manifest: ```json "enedisHalfHourMonthlyAnalysis": { "type": "node", "file": "services/enedisHalfHourMonthlyAnalysis/ecolyo.js", - "trigger": "@cron 0 0 8 3 * *" + "trigger": "@monthly on the 3 between 10am and 12pm", } ``` diff --git a/docs/ecolyo/Technical/Services/monthly_report_notification.md b/docs/ecolyo/Technical/Services/monthly_report_notification.md index 703af1b57851cc81ea692148580dbb935d9a3963..31d1eaa73dd29b19574476b2efe1e45b98c1667c 100644 --- a/docs/ecolyo/Technical/Services/monthly_report_notification.md +++ b/docs/ecolyo/Technical/Services/monthly_report_notification.md @@ -1,12 +1,12 @@ # Monthly report notification -This service will run the 3rd of each month at 10.00 am, as defined in the manifest: +This service will run the 3rd of each month between 12pm (noon) and 2pm, as defined in the manifest: ```json "monthlyReportNotification": { "type": "node", "file": "services/monthlyReportNotification/ecolyo.js", - "trigger": "@cron 0 0 10 3 * *" + "trigger": "@monthly on the 3 between 12pm and 2pm", } ``` diff --git a/docs/ecolyo/Technical/mail.md b/docs/ecolyo/Technical/mail.md index c7f430684a1efb49a41dcfb2836ddb217ca23960..6f9a088167f401d860e0517fcaaf78bcdf30ada4 100644 --- a/docs/ecolyo/Technical/mail.md +++ b/docs/ecolyo/Technical/mail.md @@ -75,6 +75,17 @@ const mjml2html = require('mjml-browser'); - [Mjml live editor](https://mjml.io/try-it-live/bohYnxKkCq-) +### Send mails in local development + +Build the app in dev mode and run the desired service. + +```sh +yarn build-dev +yarn run cozy-konnector-dev -m manifest.webapp ./build/services/monthlyReportNotification/ecolyo.js +``` + +Mailhog will intercept the mails and display them at http://cozy.tools:8025/ + ## Bounce token A bounce token stored in the profile of each user is sent in email. It allows us to track if user clicks on links. diff --git a/docs/konnectors/0-index.md b/docs/konnectors/0-index.md index 59960a2b8e8f83b1c46b8f3a1d0edec36a4c6ee4..3c8c14ccbda1d2f967fb80e53f554e491fa6fd18 100644 --- a/docs/konnectors/0-index.md +++ b/docs/konnectors/0-index.md @@ -19,6 +19,14 @@ Some variation have to be considered : - When a konnector is launched by the cozy stack (at a random time between 7am and 10am), it fetches 3 years of data. - When a konnector retrieves a load at the half-hour timeline (ex: enedis), it fetches back to 4 weeks. +All the konnectors can update previously imported data if it has changed since last execution. + +:::info + +Since version `3.1.0` of the app, the konnectors are now also handling the prices. + +::: + ## Documentation - Checkout the [konnector doc](https://docs.cozy.io/en/cozy-konnector-libs/) from cozy diff --git a/static/img/ecolyo/newsletter-reminder.png b/static/img/ecolyo/newsletter-reminder.png new file mode 100644 index 0000000000000000000000000000000000000000..3f8efeb6dfd60ba2a6a6cc53810c84f4ef783f31 Binary files /dev/null and b/static/img/ecolyo/newsletter-reminder.png differ