Skip to content

Add rolling forecast slots (now..+2h, +2h..+4h, ...) - #6

Merged
yeled merged 1 commit into
mainfrom
rolling-slots
Jun 24, 2026
Merged

yeled merged 1 commit into
mainfrom
rolling-slots

Conversation

@yeled

@yeled yeled commented Jun 24, 2026

Copy link
Copy Markdown
Owner

Summary

  • Adds a Rolling Slots setting (rolling_mode custom field / --rolling CLI flag): instead of fixed clock times, the first slot anchors to the current hour and steps forward by 2h on every refresh, so the forecast always shows what's coming up next.
  • 1-day range: one continuous 16h rolling window (8 slots). If it spans midnight, the trailing slots stay in the same block rather than splitting into a separate "Tomorrow" section.
  • 2-day range: only today rolls (stopping at midnight). Tomorrow isn't a rolling continuation — that would land it on whatever odd hours the rollover happens to hit — so it always shows a fixed 6am/10am/2pm/6pm spread instead.
  • Wired through trmnl_report.py (--rolling), weather.cgi (?rolling=1), and the plugin's polling_url/custom fields in src/settings.yml.

Bleed fix surfaced by this work

Rolling mode can produce a day-block with 2 rows of cells alongside a sibling with just 1 row. The templates previously gave every .wc-day an equal flex:1 share regardless of content, so a 2-row block would overflow into its sibling (overlapping text/headers). Fixed by:

  • Computing each day's row count server-side (d.rows) and sizing blocks proportionally via a data-rows attribute + CSS in full.liquid, half_vertical.liquid, half_horizontal.liquid.
  • Tightening half_vertical's icon size/padding, which was still clipping its bottom row even after the proportional fix (not enough total height for current-weather panel + a 2-row day + a 1-row day).

Test plan

  • Verified rolling math directly: correct anchor/window computation, correct midnight-crossing grouping, correct rows-per-day.
  • Verified through both --rolling CLI flag and weather.cgi?rolling=1 query param.
  • Rendered all 4 layouts (full, half_vertical, half_horizontal, quadrant) for: fixed mode (regression), 1-day rolling with midnight spillover, and 2-day rolling — all clean, no overlap or clipping.
  • Confirmed fixed (non-rolling) mode payloads are unchanged.

🤖 Generated with Claude Code

Adds a Rolling Slots setting/--rolling flag: instead of fixed clock
times, each refresh anchors the first slot to the current hour and
steps forward by 2h. For a 1-day range this is one continuous 16h
window; for 2 days, only today rolls -- tomorrow gets a fixed
6am/10am/2pm/6pm spread instead of a rolling continuation, since
"tomorrow" is meant to be a deliberate full day, not whatever
oddly-timed hours the rollover lands on.

Also fixes a layout bleed this surfaced: when a day's cells wrap to
two grid rows, every .wc-day block was getting an equal flex:1 share
regardless of its own row count, so a 2-row block could overflow into
a 1-row sibling. Each day's row count is now in the payload (d.rows)
and the templates size blocks proportionally via a data-rows
attribute. Also tightened half_vertical's icon size/padding, which
was clipping its bottom row even after the proportional fix.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@yeled
yeled merged commit 3bb2cf9 into main Jun 24, 2026
2 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