Skip to content

Commit

Permalink
event simulation
Browse files Browse the repository at this point in the history
  • Loading branch information
Giga77 committed Apr 7, 2024
1 parent 4bfe4a7 commit 57929c2
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 10 deletions.
49 changes: 40 additions & 9 deletions custom_components/ecole_directe/coordinator.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

from .ecole_directe_helper import (
EDEleve,
EDGrade,
get_ecoledirecte_session,
get_homeworks,
get_grades,
Expand Down Expand Up @@ -124,15 +125,45 @@ async def _async_update_data(self) -> dict[Platform, dict[str, Any]]:
eleve,
format_grade,
)
# if "MESSAGERIE" in eleve.modules:
# try:
# self.data[
# "messages" + eleve.eleve_id
# ] = await self.hass.async_add_executor_job(
# get_messages, session, eleve, year_data
# )
# except Exception as ex:
# _LOGGER.warning("Error getting messages from ecole directe: %s", ex)
# if "MESSAGERIE" in eleve.modules:
# try:
# self.data[
# "messages" + eleve.eleve_id
# ] = await self.hass.async_add_executor_job(
# get_messages, session, eleve, year_data
# )
# except Exception as ex:
# _LOGGER.warning("Error getting messages from ecole directe: %s", ex)

# fake event new_grade
# grade = EDGrade(
# data={
# "codeMatiere": "FRANC",
# "codePeriode": "A001",
# "codeSousMatiere": "",
# "coef": "1",
# "commentaire": "",
# "date": "2023-09-23",
# "dateSaisie": "2023-10-04",
# "devoir": "Rédaction : randonnée de début d'année",
# "enLettre": False,
# "id": 8388851,
# "libelleMatiere": "FRANCAIS",
# "moyenneClasse": "12.61",
# "nonSignificatif": False,
# "noteSur": "20",
# "typeDevoir": "ECRIT",
# "uncCorrige": "",
# "uncSujet": "",
# "valeur": "14,5",
# "valeurisee": False,
# }
# )
# self.trigger_event(
# "new_grade",
# eleve,
# format_grade(grade),
# )

return self.data

Expand Down
2 changes: 1 addition & 1 deletion custom_components/ecole_directe/ecole_directe_formatter.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ def format_homework(homework):
return {}


def format_grade(grade):
def format_grade(grade) -> dict:
"""grade fromat"""
try:
return {
Expand Down

0 comments on commit 57929c2

Please sign in to comment.