Show where a season came from; check it
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
fbb43d9ff0
commit
03c2611036
7 files changed
+73
-3
No files matched your search
@@ -185,6 +185,30 @@ def season_text(rec):
|
||||
return words.join_names(MONTHS[m - 1] for m in ms)
|
||||
|
||||
|
||||
SEASON_BASIS_TEXT = {
|
||||
"primary": "The season comes from the page of the body that manages the trail or, for a route, its author.",
|
||||
"sources": "Two or more pages from different publishers agree on the season.",
|
||||
"source": "One page states the season. It is not the trail's own page.",
|
||||
}
|
||||
|
||||
|
||||
def season_basis(rec):
|
||||
"""Where the season came from: primary, sources, source or estimate; "" when it has none."""
|
||||
h = hike.table(rec)
|
||||
if not h.get("season") and not h.get("months"):
|
||||
return ""
|
||||
return h.get("season_basis") or ""
|
||||
|
||||
|
||||
def season_basis_line(rec):
|
||||
"""One sentence for "About this data"; "" when the season has no recorded basis."""
|
||||
basis = season_basis(rec)
|
||||
if basis == "estimate":
|
||||
method = (hike.table(rec).get("season_method") or "").strip()
|
||||
return (method + " No page states a season.").strip()
|
||||
return SEASON_BASIS_TEXT.get(basis, "")
|
||||
|
||||
|
||||
# Terrain, Walking, Shape ----------------------------------------------------
|
||||
|
||||
TERRAIN_VALUES = words.TERRAIN
|
||||
|
||||
+3
-1
@@ -1563,7 +1563,9 @@ def hike_sources_block(rec):
|
||||
body = f'<ul class="linklist">{items}</ul>' if items else \
|
||||
'<p class="record-text">The record names no page for these facts.</p>'
|
||||
checked = f'<p class="note">Checked {esc(h["checked"])}.</p>' if h.get("checked") else ""
|
||||
return block("hike-title", "Where the hiking facts come from", Markup(body + checked))
|
||||
basis = facets.season_basis_line(rec)
|
||||
basis = f'<p class="note">{esc(basis)}</p>' if basis else ""
|
||||
return block("hike-title", "Where the hiking facts come from", Markup(body + checked + basis))
|
||||
|
||||
|
||||
def about_data(rec, site, author_links=None):
|
||||
|
||||
Reference in new issue
Block a user