Fix paths import

This commit is contained in:
Gabriel Augendre 2022-10-30 16:14:57 +01:00
parent 920fbbeea4
commit 95a4e2bdd3

View file

@ -39,7 +39,7 @@ class Command(BaseCommand):
race = None race = None
if category == Path.Category.RACE: if category == Path.Category.RACE:
race = self.get_race(name) race = self.get_race(name)
notes = self.get_notes(name) notes = self.get_notes()
path, _ = Path.objects.update_or_create( path, _ = Path.objects.update_or_create(
name=name, name=name,
@ -95,10 +95,10 @@ class Command(BaseCommand):
except Exception: except Exception:
self.stdout.write(self.style.WARNING(f"Couldn't find race for {path_name}")) self.stdout.write(self.style.WARNING(f"Couldn't find race for {path_name}"))
def get_notes(self, path_name: str) -> str: def get_notes(self) -> str:
try: try:
return self.selenium.find_element( return self.selenium.find_element(
By.CLASS_NAME, "field--name-description" By.CSS_SELECTOR, ".mt-3 > .field--name-description"
).text.strip() ).text.strip()
except Exception: except Exception:
return "" return ""