Skip to content

Commit

Permalink
feat: Support item trail numbers also to help match the right one
Browse files Browse the repository at this point in the history
  • Loading branch information
dpriskorn committed Dec 1, 2024
1 parent f1f2d99 commit 900f07c
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion src/models/trail_item.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,17 @@ class TrailItem(ProjectBaseModel):
class Config:
arbitrary_types_allowed = True

@property
def trail_number(self) -> str:
if self.item:
trail_number_claims = self.item.claims.get(property="P1824")
if trail_number_claims:
return str(trail_number_claims[0].mainsnak.datavalue["value"])
else:
return ""
else:
return ""

@property
def has_osm_way_property(self) -> bool:
if not self.item:
Expand Down Expand Up @@ -241,7 +252,8 @@ def __ask_question__(self) -> QuestionaryReturn:
return_ = questionary.select(
(
f"Which of these match '{self.label}' "
f"with description '{self.description}'? "
f"with description '{self.description}' "
f"and trail number '{self.trail_number}'? "
f"(see {self.item.get_entity_url()})"
),
choices=self.choices,
Expand Down

0 comments on commit 900f07c

Please sign in to comment.