Skip to content

Commit

Permalink
fix sorting homeworks
Browse files Browse the repository at this point in the history
  • Loading branch information
Giga77 committed May 12, 2024
1 parent 5d0941d commit b41189d
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 11 additions & 2 deletions custom_components/ecole_directe/ecole_directe_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,6 +202,16 @@ def __init__(self, data, pour_le):
def __getitem__(self, key):
return self

def __lt__(self, other):
return self.pour_le < other

def __gt__(self, other):
return self.pour_le > other

def __repr__(self):
"""Allow seeing value instead of object description"""
return str(self.pour_le + " - " + self.matiere)


class EDGrade:
"""Grade information"""
Expand Down Expand Up @@ -523,16 +533,15 @@ def get_homeworks(token, eleve, config_path):
homeworks_by_date_json = get_homeworks_by_date(
token, eleve, key, config_path
)
_LOGGER.debug("homeworks_by_date_json:%s", homeworks_by_date_json)
for matiere in homeworks_by_date_json["matieres"]:
for homework in data[key]:
if matiere["id"] == homework["idDevoir"]:
homework["nbJourMaxRenduDevoir"] = matiere[
"nbJourMaxRenduDevoir"
]
homework["contenu"] = matiere["aFaire"]["contenu"]
_LOGGER.debug("homework:%s", homework)

_LOGGER.debug("homework_json:%s", homework_json)
hw = EDHomework(homework_json, key)
_LOGGER.debug("hw:%s", hw)
if not hw.effectue:
Expand Down
2 changes: 1 addition & 1 deletion custom_components/ecole_directe/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -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.0.6"
"version": "0.2.7"
}

0 comments on commit b41189d

Please sign in to comment.