From b0656ff84f22d6caafff4461f2c252230c858daf Mon Sep 17 00:00:00 2001 From: Giga77 <2777446+Giga77@users.noreply.github.com> Date: Sat, 23 Nov 2024 15:32:50 +0100 Subject: [PATCH 1/2] Remplace virgule par point --- .../ecole_directe/ecole_directe_helper.py | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/custom_components/ecole_directe/ecole_directe_helper.py b/custom_components/ecole_directe/ecole_directe_helper.py index c0682da..5bf096d 100644 --- a/custom_components/ecole_directe/ecole_directe_helper.py +++ b/custom_components/ecole_directe/ecole_directe_helper.py @@ -514,10 +514,10 @@ def get_grades_evaluations(token, eleve, annee_scolaire, config_path): response["disciplines"] = get_disciplines_periode(periode_json) if periode_json["ensembleMatieres"]: response["moyenne_generale"] = { - "moyenneGenerale": periode_json["ensembleMatieres"].get("moyenneGenerale", ""), - "moyenneClasse": periode_json["ensembleMatieres"].get("moyenneClasse", ""), - "moyenneMin": periode_json["ensembleMatieres"].get("moyenneMin", ""), - "moyenneMax": periode_json["ensembleMatieres"].get("moyenneMax", ""), + "moyenneGenerale": periode_json["ensembleMatieres"].get("moyenneGenerale", "").replace(",","."), + "moyenneClasse": periode_json["ensembleMatieres"].get("moyenneClasse", "").replace(",","."), + "moyenneMin": periode_json["ensembleMatieres"].get("moyenneMin", "").replace(",","."), + "moyenneMax": periode_json["ensembleMatieres"].get("moyenneMax", "").replace(",","."), "dateCalcul": periode_json["ensembleMatieres"].get("dateCalcul", ""), } @@ -580,10 +580,10 @@ def get_disciplines_periode(data): for discipline_json in data["ensembleMatieres"]["disciplines"]: discipline = { "name": discipline_json.get("discipline", "").lower(), - "moyenne": discipline_json.get("moyenne", ""), - "moyenneClasse": discipline_json.get("moyenneClasse", ""), - "moyenneMin": discipline_json.get("moyenneMin", ""), - "moyenneMax": discipline_json.get("moyenneMax", ""), + "moyenne": discipline_json.get("moyenne", "").replace(",","."), + "moyenneClasse": discipline_json.get("moyenneClasse", "").replace(",","."), + "moyenneMin": discipline_json.get("moyenneMin", "").replace(",","."), + "moyenneMax": discipline_json.get("moyenneMax", "").replace(",","."), "appreciations": discipline_json.get("appreciations", ""), } disciplines.append(discipline) From 2fd347549130e12f73861a93a87d4fd27c0c40f0 Mon Sep 17 00:00:00 2001 From: Giga77 <2777446+Giga77@users.noreply.github.com> Date: Sat, 23 Nov 2024 15:33:26 +0100 Subject: [PATCH 2/2] Ajout de l'attribut nom dans les moyennes de la discipline --- custom_components/ecole_directe/manifest.json | 2 +- custom_components/ecole_directe/sensor.py | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/custom_components/ecole_directe/manifest.json b/custom_components/ecole_directe/manifest.json index 5c023d5..63e2914 100644 --- a/custom_components/ecole_directe/manifest.json +++ b/custom_components/ecole_directe/manifest.json @@ -9,5 +9,5 @@ "documentation": "https://github.com/hacf-fr/hass-ecoledirecte", "iot_class": "cloud_polling", "issue_tracker": "https://github.com/hacf-fr/hass-ecoledirecte/issues", - "version": "0.3.17" + "version": "0.3.18" } \ No newline at end of file diff --git a/custom_components/ecole_directe/sensor.py b/custom_components/ecole_directe/sensor.py index ba9bd03..1d0b197 100644 --- a/custom_components/ecole_directe/sensor.py +++ b/custom_components/ecole_directe/sensor.py @@ -276,6 +276,7 @@ def extra_state_attributes(self): return { "updated_at": self.coordinator.last_update_success_time, + "nom": discipline["name"], "moyenneClasse": discipline["moyenneClasse"], "moyenneMin": discipline["moyenneMin"], "moyenneMax": discipline["moyenneMax"],