mirror of
https://github.com/Tria-plc/edr-platform.git
synced 2026-08-26 12:41:04 +00:00
Grouped by Train, a row was a period average over the train's stops, which threw away the one thing that grain is for: when the work actually happened. The row is now the stop itself — logged arrival, departure, unloading and loading times, and that stop's own durations. Grouped by Station it still averages over every train that called there. The two shapes need different columns, so `ReportColumn.hideWhen` names the filter values that hide a column, and the runner resolves sort against the visible set — sorting by an average and then switching to Train falls back to the default sort instead of a 42703 on a column the query no longer selects. `ReportFilterDef.defaultValue` pins the unset grain to `train`, so "no value" is never a third shape. The table, the export field list and the chart toggle all follow the visible set; the chart is station-grain only, since per-stop rows have nothing to bar-chart. Both grains EXPLAIN-validated and run against the dev database. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>