11-09-2020 21:11
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

11-09-2020 21:11
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
Currently, my app reports the total steps for a period from userActivity.today.adjusted["steps"]. I record the initial value and subtract it from the end value to get the total steps taken during the activity. I've been struggling to figure out how to make this work if someone starts an activity before midnight and completes it after. The userActivity.today.adjusted["steps"] resets to zero at midnight and I tried userActivity.yesterday.adjusted["steps"] but userActivity.yesterday is undefined. Is there an easy way to pull yesterday's totals? My plan B is to save and update max steps until steps is less than max steps (indicating the day changed).

11-09-2020 21:39
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post


11-09-2020 21:39
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Perhaps not an easy way, but have a look at dayHistory.
Gondwana Software
11-10-2020 11:01
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post

11-10-2020 11:01
- Mark as New
- Bookmark
- Subscribe
- Permalink
- Report this post
- Who Voted for this post?
Thanks! I was able to pull yesterday's data with:
let dayRecords = dayHistory.query();
let stepsYesterday = dayRecords[0].steps;
