Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add queryStatisticsCollectionForQuantity #83

Closed

Conversation

davidyang
Copy link

Hi @robertherber - tested this out and works for getting data out. Wanted to run it by you, looking more at it I'm realizing there's some type definition issues. I can iron those out if you think this is on the right path.

Also, I have XCode 15 and had to make some pretty messy changes to the examples/ almost to the point I'm not sure it's reproducible. I'll check in those changes on another branch updated-example

@davidyang davidyang force-pushed the addStatisticsCollection branch from 540463b to be7612a Compare October 31, 2023 20:30
Copy link

Expo preview is ready for review.

There should soon be a new native build available here

With that installed just scan this QR code:
QR Preview

@robertherber
Copy link
Member

I think this looks good! 👍 An update to make the example run in XCode 15 (I haven't done it myself yet) would be nice as well, but it would fit better in a PR of its own.

Two things before we merge this PR:

  • The linting fixes. If you run yarn lint --fix it should take care of itself :)
  • It would be nice with an entry in the example app, I see you have that in the other branch already.

@robertherber
Copy link
Member

robertherber commented Nov 15, 2023

@davidyang Hope I didn't put you off. To clarify - I'd be happy to merge this if the linting goes through :) Let me know if you need any support.

@davidyang
Copy link
Author

davidyang commented Nov 20, 2023 via email

@krisidmisso
Copy link

+1

@krisidmisso
Copy link

was able to integrate this PR into my project, but I couldnt get code hints.

In addition, there seems to be an issue, as the sumQuantity object sometimes gives me a quantity number that is a double for HKQuantityTypeIdentifier.stepCount (expected whole number as the unit is count).

anchorDate doesn't seem to work but I may be using it wrong. Tried to replace the code with a static date inside the library and still didn't seem to return relevant data.

Today is Feb 8, but I get some values that seem to be reported on Feb 9 and 10?

I will be happy to test again if needed. Here is some sample data:

[
  {
    "sumQuantity": {
      "endDate": "2021-07-22T23:00:00Z",
      "quantity": 23,
      "quantityType": "HKQuantityTypeIdentifierStepCount",
      "startDate": "2021-07-21T23:00:00Z",
      "unit": "count"
    }
  },
  {
    "sumQuantity": {
      "endDate": "2021-07-24T23:00:00Z",
      "quantity": 593,
      "quantityType": "HKQuantityTypeIdentifierStepCount",
      "startDate": "2021-07-23T23:00:00Z",
      "unit": "count"
    }
  },
  {
    "sumQuantity": {
      "endDate": "2024-02-02T00:00:00Z",
      "quantity": 2,
      "quantityType": "HKQuantityTypeIdentifierStepCount",
      "startDate": "2024-02-01T00:00:00Z",
      "unit": "count"
    }
  },
  {
    "sumQuantity": {
      "endDate": "2024-02-03T00:00:00Z",
      "quantity": 799.3534183322977,
      "quantityType": "HKQuantityTypeIdentifierStepCount",
      "startDate": "2024-02-02T00:00:00Z",
      "unit": "count"
    }
  },
  {
    "sumQuantity": {
      "endDate": "2024-02-04T00:00:00Z",
      "quantity": 1250,
      "quantityType": "HKQuantityTypeIdentifierStepCount",
      "startDate": "2024-02-03T00:00:00Z",
      "unit": "count"
    }
  },
  {
    "sumQuantity": {
      "endDate": "2024-02-05T00:00:00Z",
      "quantity": 491,
      "quantityType": "HKQuantityTypeIdentifierStepCount",
      "startDate": "2024-02-04T00:00:00Z",
      "unit": "count"
    }
  },
  {
    "sumQuantity": {
      "endDate": "2024-02-07T00:00:00Z",
      "quantity": 4497.503525622739,
      "quantityType": "HKQuantityTypeIdentifierStepCount",
      "startDate": "2024-02-06T00:00:00Z",
      "unit": "count"
    }
  },
  {
    "sumQuantity": {
      "endDate": "2024-02-08T00:00:00Z",
      "quantity": 3561,
      "quantityType": "HKQuantityTypeIdentifierStepCount",
      "startDate": "2024-02-07T00:00:00Z",
      "unit": "count"
    }
  },
  {
    "sumQuantity": {
      "endDate": "2024-02-09T00:00:00Z",
      "quantity": 36,
      "quantityType": "HKQuantityTypeIdentifierStepCount",
      "startDate": "2024-02-08T00:00:00Z",
      "unit": "count"
    }
  },
  {
    "sumQuantity": {
      "endDate": "2024-02-10T00:00:00Z",
      "quantity": 500,
      "quantityType": "HKQuantityTypeIdentifierStepCount",
      "startDate": "2024-02-09T00:00:00Z",
      "unit": "count"
    }
  }
]

@taisuke-j
Copy link
Contributor

taisuke-j commented Oct 23, 2024

@robertherber (CC: @davidyang )

Resolved lint errors, added an entry in the example app and did some refactors. Should I make a separate PR?

taisuke-j@851ab0f

@robertherber
Copy link
Member

@robertherber (CC: @davidyang )

Resolved lint errors, added an entry in the example app and did some refactors. Should I make a separate PR?

taisuke-j@851ab0f

Yeah, I guess it's easier as a separate PR 👍 Thanks both of you @davidyang and @taisuke-j for contributing! 🙂

@taisuke-j
Copy link
Contributor

@robertherber No problem! Here is the PR: #111

@robertherber
Copy link
Member

Closing since this was merged with #111, thanks guys!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants