wutzcalc/server
Repository files (latest commit first)
Filename Latest commit message Latest commit date
iris f576fbde3e stats: zero-fill by_hour gaps; fix chart blank labels + unnecessary rebuilds
Closes #52, closes #55. Follow-ups from the #47 review round.

#52: by_hour_of_day was already zero-filled across 0-23 (deliberately, so a
quiet hour doesn't misread as missing data) but by_hour — the continuous
timeline — wasn't. The client renders it on a categorical axis, so closed
hours between two festival nights collapsed to nothing and the last hour of
one night sat directly next to the first hour of the next. Now zero-filled
between the first and last real bucket, same reasoning as by_hour_of_day.

#55, two fixes:
- DayChart's x scale is now explicitly ordinal (distr: 2). The prior default
  (linear) let uPlot's tick generator pick fractional increments on a short
  series, and the index-based label lookup misses on a non-integer tick,
  rendering a blank label.
- The four per-day/per-hour chart data preps in Stats.tsx now produce a
  single memoized {labels, series} object each, instead of building fresh
  labels/series array literals inline in JSX on every render. DayChart's
  effect is keyed on those props by reference, so the old code destroyed
  and recreated every uPlot instance on any unrelated Dashboard re-render
  (e.g. the isAdmin check resolving after data already loaded).

Both sides build/typecheck clean. Manually verified the zero-fill against a
seeded DB with a 3-hour gap between two transactions — by_hour correctly
returned 4 buckets (2 real, 2 zero-filled) in order.
2026-07-30 21:49:22 +02:00
..
migrations snapshot the Pfand rate used for returns, like every other money value already is 2026-07-29 20:26:52 +02:00
src stats: zero-fill by_hour gaps; fix chart blank labels + unnecessary rebuilds 2026-07-30 21:49:22 +02:00
package.json scaffold festival drink tracker (pnpm workspace, Fastify + SQLite, Preact tablet UI, admin) 2026-05-19 18:12:01 +02:00
tsconfig.json scaffold festival drink tracker (pnpm workspace, Fastify + SQLite, Preact tablet UI, admin) 2026-05-19 18:12:01 +02:00