Is your feature request related to a problem? Please describe.
Calling statisticsQuery for a QuantityType that does not have any data in Health Kit throws an error (see below) rather than returning a Statistics object with the values set to null.
Describe the solution you'd like
To maintain consistency with the behaviour observed when data does exists for the queried type but there is no data in the query time frame (for example if there is only one data point for the queried type on 06/06/22, but the query Predicate is for 07/06/22 to 08/06/22), it would be good if the function returned a Statistics object with the values set to null instead of throwing an error.
Describe alternatives you've considered
Doing a Try/Catch works, but it's counter-intuitive and more expensive.
Is your feature request related to a problem? Please describe. Calling
statisticsQuery
for aQuantityType
that does not have any data in Health Kit throws an error (see below) rather than returning aStatistics
object with the values set to null.Describe the solution you'd like To maintain consistency with the behaviour observed when data does exists for the queried type but there is no data in the query time frame (for example if there is only one data point for the queried type on 06/06/22, but the query
Predicate
is for 07/06/22 to 08/06/22), it would be good if the function returned aStatistics
object with the values set to null instead of throwing an error.Describe alternatives you've considered Doing a Try/Catch works, but it's counter-intuitive and more expensive.
Additional context See #48