mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-12 22:26:13 +00:00
A device can write the same period twice: an original envelope and a corrected one, same start, later end, distinct external ids. Both rows belong to the same writer, so the writer collapse keeps both, and the per-stage totals added them. One night served a 10 h 13 min in-bed headline next to a 20 h 17 min in-bed legend on the same screen, and the hypnogram drew the night twice over. Every per-stage total is now the measure of the union of that stage's spans rather than the sum of the rows, and the same merged spans feed the hypnogram segments and the time-asleep headline. Stages merge independently: two stages describing one minute is a contest, and the writer collapse is this file's mechanism for that - arbitrating again would collapse the summary-shaped writers, which stamp every stage total on the sleep end instant and nest by design. stages.IN_BED is now the in-bed envelope itself, the same union inBedMinutes reports, so the legend cannot contradict the headline and a night whose envelope only a losing writer recorded still reports it.