health_kit_reporter icon indicating copy to clipboard operation
health_kit_reporter copied to clipboard

Can not import Sleep entries if they cross over a predicate time period

Open SamBergeron opened this issue 1 year ago • 0 comments

Describe the bug This is the same issue that was happening with workout but it the same with category imports (sleep specifically) this would also fix it for all other category imports. Currently there is no way to do category imports that are not explicitly inside the predicate time range.

To Reproduce Create a sleep entry in Apple health, starting at 11:30pm and ending at 12:30 am the next day Create a predicate for the starting day from 12:00 to 12:00 the next day. The sleep entry is not imported. The sleep is also not imported if you do the same thing for the next day.

i.e if you import on 24hr increments for a day, and you workout overlaps you cannot import it in any day whatsoever because import logic is strict. The workout start time and end time must be included entirely in the predicate range.

Expected behavior You are able to import overlapping sleep entries

Additional context Native healthkit exposes "options" you can pass to samples query but those options are not available in the flutter plugin, so there's nothing we can do about it. I've coded a PR for this I will link to

This is essentially the exact same thing as #66 but we just applied the same logic to category entries

SamBergeron avatar Feb 26 '24 18:02 SamBergeron