Don't show a title/link for commemorations with empty story markup - #172
Merged
Conversation
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
DayCommemoration.storyis a nullableTextField. 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.day.saint_linksx2,day.storiesincalendarium/liturgics/day.py) used a bareif dc.storytruthiness 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._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)liturgics.Day(2026, 5, 4, tradition='slavic')for "St Monica, mother of Blessed Augustine (388)" (story='<p></p>') now showsstory_id=Noneinsaint_linksand is excluded fromday.stories, matching the reported bug exactly🤖 Generated with Claude Code
https://claude.ai/code/session_01Hf6j2xXQXywHVh3HAVRxB3