Sort elements by ILIAS id to ensure deterministic ordering

This commit is contained in:
I-Al-Istannen
2021-07-06 17:45:12 +02:00
parent 8ec3f41251
commit ee67f9f472
2 changed files with 15 additions and 0 deletions

View File

@ -38,6 +38,17 @@ class IliasPageElement:
mtime: Optional[datetime] = None
description: Optional[str] = None
def id(self) -> str:
regexes = [r"eid=(?P<id>[0-9a-z\-]+)", r"file_(?P<id>\d+)", r"ref_id=(?P<id>\d+)"]
for regex in regexes:
if match := re.search(regex, self.url):
return match.groupdict()["id"]
# Fall back to URL
log.warn(f"Didn't find identity for {self.name} - {self.url}. Please report this.")
return self.url
class IliasPage: