Skip to content

Don't show the featured event layout without race-day weather#360

Merged
gesteves merged 1 commit into
mainfrom
claude/featured-event-weather-bug-v2q1zy
Jun 11, 2026
Merged

Don't show the featured event layout without race-day weather#360
gesteves merged 1 commit into
mainfrom
claude/featured-event-weather-bug-v2q1zy

Conversation

@gesteves

Copy link
Copy Markdown
Owner

Problem

The featured event was getting the expanded "featured" treatment (bigger card + a Race Day Weather heading) even when it was effectively more than 10 days out, leaving an empty weather block.

The cause is two different 10-day windows:

  • Featuring (is_featured?is_close?) checks the window in the owner's current-location timezone.
  • Weather fetch (event_weather_for) computes days_until in the event's own geocoded timezone and only fetches a forecast when days_until.between?(0, 10).

At the 10-day boundary these disagree, so an event can be flagged "featured" while no forecast was ever fetched. The EventWeatherPresenter is still non-nil (the event has coordinates), so the inline _event_weather partial renders its "Race Day Weather" heading with no actual forecast underneath.

Fix

  • In EventsController#upcoming, when an upcoming (not-today) featured event has no forecast (@event_weather.forecast blank), demote it to a regular upcoming race: clear @featured/@event_weather and trim the list back to the non-featured count of 3. Today's race keeps its own section regardless — it's race day.
  • In upcoming.html.erb, pass the rendered @upcoming.size and @featured flag to event_collection_variant so the collection layout class reflects what the controller actually decided (instead of re-deriving from the helper, which doesn't know about the demotion).

Tests

Added a request spec: when the next race is within the featured window but WeatherKit returns no data, the response renders it as a plain upcoming race — no collection--has-featured, no event--is-featured, no "Race Day Weather" block. Full events spec passes (the 5 failing plausible_pageviews specs are pre-existing and unrelated).

https://claude.ai/code/session_01LN8no8Vf2kqxcSGc4Ymyb8


Generated by Claude Code

The featured window (is_close?, owner timezone) and the weather-fetch
window (days_until, the event's own geocoded timezone) can disagree at
the 10-day boundary, so an event could get the featured treatment
(expanded card + a 'Race Day Weather' heading) while no forecast was
ever fetched — leaving an empty weather block for an event effectively
more than 10 days out.

Demote such an event to a regular upcoming race when the forecast is
missing, and trim the list back to the non-featured count. Today's race
keeps its own section regardless. Also pass the rendered list size and
featured flag to event_collection_variant so the layout class matches
what the controller actually decided.
@netlify

netlify Bot commented Jun 11, 2026

Copy link
Copy Markdown

Deploy Preview for giventotri canceled.

Name Link
🔨 Latest commit 884fb7e
🔍 Latest deploy log https://app.netlify.com/projects/giventotri/deploys/6a2a16973ac02a00086ebb3c

@gesteves gesteves merged commit 9acd65b into main Jun 11, 2026
8 checks passed
@gesteves gesteves deleted the claude/featured-event-weather-bug-v2q1zy branch June 11, 2026 02:00
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.

2 participants