mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
SleepSyncer was inserting the same sleep session in multiple slices when the session spanned a slice boundary. The 1-day look-back caused the session to be re-discovered in adjacent slices, and the overlap check allowed it to be synced in each one. Assign each session to the slice where its start time falls ([sliceStart, sliceEnd)). This ownership rule ensures each session is synced exactly once regardless of how many slices it overlaps with. Add a 12-hour look-forward to the DB query for SLEEP so that sessions starting near the slice end are fetched with their full data, preventing truncation at the slice boundary. Fixes: https://codeberg.org/Freeyourgadget/Gadgetbridge/issues/5873