From 3305c23ee5e88e4efaf870044e8950b80dc76799 Mon Sep 17 00:00:00 2001 From: Stephen Waits Date: Fri, 20 Nov 2026 13:33:21 -0700 Subject: [PATCH] Say season once where a source names season and months --- web/olt/trail.py | 2 +- web/tests/test_hike.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/web/olt/trail.py b/web/olt/trail.py index 5a5f11f..c61a515 100644 --- a/web/olt/trail.py +++ b/web/olt/trail.py @@ -1567,7 +1567,7 @@ def hike_sources_block(rec): for src in hike.sources(rec): url = src.get("url", "") who = src.get("publisher") or (host(url) if url else "Source") - facts_ = [words.HIKE_FACTS.get(f, f) for f in src.get("facts", [])] + facts_ = list(dict.fromkeys(words.HIKE_FACTS.get(f, f) for f in src.get("facts", []))) # season and months read alike what = ("For " + words.join_names(facts_)) if facts_ else "" link = ext_link(url, who) if url else esc(who) detail = " ยท ".join(x for x in (host(url) if url else "", what) if x) diff --git a/web/tests/test_hike.py b/web/tests/test_hike.py index 81916f8..10d5d10 100644 --- a/web/tests/test_hike.py +++ b/web/tests/test_hike.py @@ -153,6 +153,12 @@ class TrailPageTest(unittest.TestCase): block = html.unescape(trail.hike_sources_block(rec)) self.assertIn("Snow and mud last into March. Confidence: high. No page states a season.", block) + def test_a_source_naming_season_and_months_says_season_once(self): + rec = sample_record("X Trail") + rec["hike"] = dict(FULL_HIKE, season_basis="primary") + block = html.unescape(trail.hike_sources_block(rec)) + self.assertNotIn("season and season", block) + def test_a_stated_season_row_has_no_note(self): rec = sample_record("X Trail") rec["hike"] = dict(FULL_HIKE, season_basis="primary")