cordova-plugin-health
cordova-plugin-health copied to clipboard
Parameters 'limit' and 'ascending' are ignored when querying workouts on iOS
Hi,
It seems like the following parameters are ignored when querying data:
- limit?: number
- ascending?: boolean
My query looks like this ('start' and 'end' are from type Date):
this.health.query({
startDate: start,
endDate: end,
ascending: false,
limit: 3,
dataType: 'workouts'
})
Expected result: 3 results between startDate and endDate, in descending order.
Actual result: 10 (all) results between startDate and endDate, in ascending order.
I tried different limits (1, 3, 5, 10), it doesn't effect the result, it seems like the parameters are ignored. I always get all data between the dates set.
Furthermore, the documentation says:
Datapoints are ordered in an descending fashion (from newer to older)
Although if I skip the 'ascending' parameter, it's still ordered ascending, not descending. I simply can't change the ordering and by default it's ascending, not descending as described.
The other parameters like startDate or dataType are working perfectly, so the query itself should be fine.
which operating system?
which operating system?
iOS 14.4 on a real device (iPhone X).
it's not supported for workouts, see https://github.com/dariosalvi78/cordova-plugin-health/blob/bfe553141b2ae76175a0a74aead3339446d37aa3/src/ios/HealthKit.m#L796
any help to fix this is welcome