kvs-coder / health_kit_reporter

A Flutter wrapper for the HealthKitReporter library
https://pub.dev/packages/health_kit_reporter
MIT License
38 stars 38 forks source link

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

Open SamBergeron opened 9 months ago

SamBergeron commented 9 months ago

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