From dad8e2d1ceb2bcff2e32d31c1ff7f243a61c70ff Mon Sep 17 00:00:00 2001 From: Kenneth Reitz Date: Sat, 6 Dec 2025 14:24:30 -0500 Subject: [PATCH] Fix ] key navigation on Verse of the Day MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - next_date is now None when viewing today (can't go to future) - ] only navigates when viewing a past date - Simplified template logic 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude --- kjvstudy_org/routes/misc.py | 3 ++- kjvstudy_org/templates/verse_of_the_day.html | 5 +---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/kjvstudy_org/routes/misc.py b/kjvstudy_org/routes/misc.py index f8781f6..d645500 100644 --- a/kjvstudy_org/routes/misc.py +++ b/kjvstudy_org/routes/misc.py @@ -240,8 +240,9 @@ async def verse_of_the_day_page( # Calculate prev/next dates for navigation prev_date = (current_date - timedelta(days=1)).strftime("%Y-%m-%d") - next_date = (current_date + timedelta(days=1)).strftime("%Y-%m-%d") today_str = datetime.now().strftime("%Y-%m-%d") + # Only allow next_date if viewing a past date (can't go to future) + next_date = (current_date + timedelta(days=1)).strftime("%Y-%m-%d") if date_str < today_str else None # Generate past 30 days of verses (from the viewed date) past_verses = [] diff --git a/kjvstudy_org/templates/verse_of_the_day.html b/kjvstudy_org/templates/verse_of_the_day.html index 7ccf5fc..df66199 100644 --- a/kjvstudy_org/templates/verse_of_the_day.html +++ b/kjvstudy_org/templates/verse_of_the_day.html @@ -465,11 +465,8 @@ } else if (e.key === ']') { // Next day (only if not viewing future) e.preventDefault(); - {% if not is_today %} + {% if next_date %} window.location.href = '/verse-of-the-day?date={{ next_date }}'; - {% else %} - // Already on today, go to today's page (removes query param) - window.location.href = '/verse-of-the-day'; {% endif %} } else if (e.key === 't') { // Jump to today