Revert precip% hiding; headline now says 'slim chance of rain' instead

Wrong direction on the previous fix -- hiding the number lost real
information. Better fix: when no hour's icon is rain-classified but there's
still a real (if low) numeric precip_prob somewhere in the day, the
headline now says 'Mostly dry, slim chance of rain' instead of a flat 'Dry
today' that silently disagreed with a 5% sitting on an hour card. Rain% is
shown unconditionally again everywhere (hourly cards, next-2-days cards,
the Now hero line).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
jtricerolph 2026-08-25 13:21:14 +00:00
parent 7780ef42a3
commit c6be990f6b
2 changed files with 13 additions and 13 deletions

View file

@ -27,6 +27,13 @@ export function summarizeToday(points, nowHour) {
const rainFraction = rainPoints.length / points.length
const snowFraction = snowPoints.length / points.length
// precip_prob is a separate field from the icon (see the frontend fix this
// replaces) — an hour's icon can be non-rain while it still carries a real, if
// slim, numeric chance. Worth surfacing in the headline rather than a flat "Dry"
// that silently disagrees with a "5%" sitting right there on an hour card.
const precipValues = points.map(p => p.precip_prob).filter(v => v != null)
const maxPrecip = precipValues.length ? Math.max(...precipValues) : null
const laterPoints = points.filter(p => hourOf(p) >= nowHour)
const earlierPoints = points.filter(p => hourOf(p) < nowHour)
const laterWetFraction = laterPoints.length
@ -38,7 +45,7 @@ export function summarizeToday(points, nowHour) {
if (snowFraction > 0.3) {
headline = 'Snow expected today'
} else if (rainPoints.length === 0 && thunderPoints.length === 0) {
headline = 'Dry today'
headline = maxPrecip != null && maxPrecip >= 15 ? 'Mostly dry, slim chance of rain' : 'Dry today'
} else if (rainPoints.some(isHeavyRain) && rainFraction > 0.5) {
headline = 'Heavy rain today'
} else if (rainFraction > 0.6) {