mirror of
https://github.com/MBombeck/HealthLog.git
synced 2026-11-08 20:42:43 +00:00
The per-segment sleep sync wrote only the stage timeline; the per-night summary's vitals — average HR, respiratory rate, SDNN-based HRV, average SpO2 and the sleep score — were dropped at the fetch. Add a getsummary fetch that maps each vital to its existing MeasurementType (RESTING_HEART_RATE, RESPIRATORY_RATE, HEART_RATE_VARIABILITY, OXYGEN_SATURATION, SLEEP_SCORE), so no migration and no client-contract change: the rows flow to the sync delta under the WITHINGS source like every other server-side fetch. Each vital upserts on the stable (userId, type, source, externalId) composite keyed by the night's session id, so a re-sync overwrites rather than duplicates. A summary fetch failure is isolated so the stage segments already written survive. Fractional SpO2 is normalised to percent.