Use the exercise label instead of the button name as path

This commit is contained in:
I-Al-Istannen 2021-06-04 19:23:33 +02:00
parent df3ad3d890
commit 8ab462fb87
2 changed files with 9 additions and 1 deletions

View File

@ -27,6 +27,8 @@ ambiguous situations.
### Changed ### Changed
- Use `/` instead of `\` as path separator for (regex) rules on Windows - Use `/` instead of `\` as path separator for (regex) rules on Windows
- Use the label to the left for exercises instead of the button name to
determine the folder name
## 3.0.1 - 2021-06-01 ## 3.0.1 - 2021-06-01

View File

@ -293,7 +293,13 @@ class IliasPage:
# Add each listing as a new # Add each listing as a new
for listing in file_listings: for listing in file_listings:
file_name = _sanitize_path_name(listing.getText().strip()) parent_container: Tag = listing.findParent(
"div", attrs={"class": lambda x: x and "form-group" in x}
)
label_container: Tag = parent_container.find(
attrs={"class": lambda x: x and "control-label" in x}
)
file_name = _sanitize_path_name(label_container.getText().strip())
url = self._abs_url_from_link(listing) url = self._abs_url_from_link(listing)
log.explain(f"Found exercise detail {file_name!r} at {url}") log.explain(f"Found exercise detail {file_name!r} at {url}")
results.append(IliasPageElement( results.append(IliasPageElement(