From 900f07cecca00ff4b74e58844eaba337ca9198a7 Mon Sep 17 00:00:00 2001 From: Dennis Priskorn Date: Sun, 1 Dec 2024 17:56:33 +0100 Subject: [PATCH] feat: Support item trail numbers also to help match the right one --- src/models/trail_item.py | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/models/trail_item.py b/src/models/trail_item.py index 79bc9ae..ca91872 100644 --- a/src/models/trail_item.py +++ b/src/models/trail_item.py @@ -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: @@ -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,