Skip to content

Don't show a title/link for commemorations with empty story markup - #172

Merged
brianglass merged 2 commits into
mainfrom
fix-commemoration-titles-without-story
Aug 11, 2026
Merged

Don't show a title/link for commemorations with empty story markup#172
brianglass merged 2 commits into
mainfrom
fix-commemoration-titles-without-story

Conversation

@brianglass

Copy link
Copy Markdown
Owner

Summary

  • DayCommemoration.story is a nullable TextField. 9 rows in production have exactly <p></p> as their story -- non-empty and non-None, so truthy as a plain Python string, but renders as no visible text.
  • All three places that gate on "does this commemoration have a story" (day.saint_links x2, day.stories in calendarium/liturgics/day.py) used a bare if dc.story truthiness check, so those rows incorrectly got a clickable title in the readings-page summary list and an empty <h2> entry (heading, no body) in the story panel below.
  • Added _has_story(dc), which strips HTML tags and checks for actual non-whitespace text, and used it at all three call sites plus in _speech_worthy (the Alexa skill has the same underlying bug for the same handful of rows).

Test plan

  • docker compose run --rm --build tests -- 145 tests pass (142 existing + 3 new for _has_story)
  • Verified against the real affected data directly: liturgics.Day(2026, 5, 4, tradition='slavic') for "St Monica, mother of Blessed Augustine (388)" (story='<p></p>') now shows story_id=None in saint_links and is excluded from day.stories, matching the reported bug exactly

🤖 Generated with Claude Code

https://claude.ai/code/session_01Hf6j2xXQXywHVh3HAVRxB3

brianglass and others added 2 commits August 11, 2026 17:20
DayCommemoration.story is a nullable TextField; 9 rows in production
have exactly '<p></p>' -- non-empty and non-None, so truthy as a plain
Python string, but renders as no visible text. The three call sites
that gate on "does this commemoration have a story" (day.saint_links,
twice, and day.stories) all used bare `if dc.story`, so those rows
incorrectly earned a clickable title in the summary list and an empty
<h2> entry in the story panel below.

Adds _has_story(dc), which checks for actual non-whitespace text after
stripping HTML tags, and uses it at all three sites plus in
_speech_worthy (same underlying bug, affecting the Alexa skill's
story-based speech decision for the same handful of rows).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hf6j2xXQXywHVh3HAVRxB3
9 DayCommemoration rows had story="<p></p>" -- non-empty and non-None,
but with no actual visible text, the same underlying inconsistency
_has_story() (previous commit) now guards against at render time. This
fixes it at the source too, matching how every other story-less row
represents "no story" (story=null; 825 of them already do). The
fixture is the source of truth for both production and tests --
Dockerfile runs `loaddata calendarium commemorations` from it on every
image build, and TestCase.fixtures loads the same file.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Hf6j2xXQXywHVh3HAVRxB3
@brianglass
brianglass merged commit 4564ae7 into main Aug 11, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant