beeminder / BeeSwift

Official Beeminder for iOS app
Other
30 stars 6 forks source link

Adjust deadline when adding Apple Health integration to a goal? #31

Open bsoule opened 4 years ago

bsoule commented 4 years ago
### Desiderata
- [ ] Decide what to do
- [ ] TBD

We don't allow users to change deadlines on iOS goals on the Beeminder side of things. Apple Health aggregates metrics by day and things break or at least are confusing if the Beeminder deadline doesn't match Apple's end-of-day (which is 6pm apparently? see cognata). However, because the goal creation flow involves setting up a Beeminder goal first, and then connecting up Apple Health from within the app, it can happen that a user sets up an iOS goal that has a non-midnight deadline. (And then furthermore if they realize the problem they have to ask me to change it for them, because once it's apple-healthy we don't let them adjust it).

what's the best way to fix this?

Cognata

Verbata: beeminder time vs calendar time, beeminder end-of-day, deadlines, autodata maintenance, apple health integration,

andrewpbrett commented 4 years ago

I think it's not so much that non-midnight deadlines are the problem, it's that changing the deadline would theoretically change all the data. Like if had a midnight deadline on a steps goal, frequently go on walks at 11:30pm, and change the goal's deadline to 10pm, now all those steps count for a different day.

I believe that the iOS code already accounts for non-midnight deadlines and for simple goals, like steps, would handle that just fine.

How do we handle other integrations (Runkeeper comes to mind) where there's a similar issue?

bsoule commented 4 years ago

So iOS will aggregate steps for you for an arbitrary period of time? I was assuming it would act more like other step count services (aka fitbit, garmin, et al) where the data is aggregated by calendar day because of some confusion over deadlines I've seen in support.

All of our other autodata integrations, excepting IFTTT/Zapier, you can't add the integration to an existing goal -- the only way to get a goal integrated with runkeeper is through the goal creation wizard, and if deadlines aren't allowed for that type of goal then it gets created with a midnight deadline to begin with.

pjjh commented 4 years ago

How does this interplay with iOS changing timezone, i.e. when travelling?

andrewpbrett commented 4 years ago

You can ask for an aggregate for an arbitrary period of time, yes. The Apple Health app will always aggregate by calendar day, though, which would make the two totals different and possibly lead to confusion.

Any changes to the deadline, as well as changes to the device's timezone, could potentially cause retroactive derails, if the user were to press the "Sync last seven days" button, since now the totals would be calculated based on the new deadline.

bsoule commented 4 years ago

ok, then it sounds like we should probably stick to matching what the app says, and force the deadline back to matching the calendar day for aggregated ios goals. That might require coordination between beebody & beemios? or maybe I could just do it serverside.

it'd need to look like either:

i prefer the first solution as it's less magical -- i imagine it being less surprising to us in the future that apple is sending "deadline" at goal setup, than finding a snipped of code in beebody that checks apple-goal status and moves the deadline or something.

andrewpbrett commented 4 years ago

I think the first one is right. Once a goal is linked to Apple Health we prevent people from changing the deadline (correct? I checked one and the input field is disabled). So it's only when they first link the goal that we need to force the deadline to be midnight.

I can write something so that the app changes the deadline itself at the same time it links the goal, and alerts the user if the deadline wasn't midnight that it is now.