-
Notifications
You must be signed in to change notification settings - Fork 443
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
Can't reschedule Daily Task #655
Comments
Sounds like you're doing all the wright things here! Let me ask a few questions to better understand where the issue might be.
Where in the feed is task completion working properly, and where is it not showing up? Are the task cards showing completion correctly, but the rings up top are not?
Attaching the code that copies and updates the task in the store will be helpful here if you're okay sharing. But my guess is that CareKitStore mistakenly can't find the previous version of the task and decides to save it as a new one rather than update it. Try adding some breaking points through the code path that saves the task to see if it takes the "save" or "update" path. |
@gavirawson-apple, I think I am experiencing a similar problem here. I have created a toy example updateTaskSchedule that can reproduce the problem quite consistently as shown in the recording below. Simulator.Screen.Recording.-.iPhone.12.Pro.Max.-.2022-09-09.at.17.30.30.mp4In the test, I created a task for a user to take a daily pill anytime during the day for two days. After that, on day 3, I update the schedule for this task such that from day 4, the user will start to take the pill every other day. When I update the schedule, I set the effectiveDate to be on day 4 so the existing outcomes remain. As shown in the video, there is no error in updating the schedule, the card shows up in the future, and I can also go back to the previous days. However, the program will crash the moment I sweep the calendar to a new week. The corresponding screenshot of Xcode is It would be great if you can take a look on this. I am not sure if there is something wrong with my code. Thanks. |
I have a task for a user to take a pill every day at a time of their choosing. I want to give them the ability to reschedule it, and tried two different things, but the both seem to be creating problems.
First, I tried updating the task's schedule to set the existing OCKScheduleElement to have an end date of today, and add a new OCKScheduleElement that starts tomorrow with the new time the user has chosen. This resulted in the following error:
Okay great, and thanks CareKit team for providing a really descriptive error with potential solutions! So next, I tried the latter solution since that seems sensible in my case - I updated the existing task with the new schedule, and set the
effectiveDate
to tomorrow.That solution allowed me to save the changes, but there were two problems. One is that the Daily Care view stopped showing previous days as checked, even though I could go to those days and see that the task had been completed. The second is that I now had two tasks in the store with the same ID, so if I tried to delete or modify them further, I got an error:
Is this a bug, or am I just not doing this correctly? Should I be assigning the task a new ID when I edit it, so it doesn't conflict with the previous one? Should I just be creating a new task entirely and setting an end date on the old one?
The text was updated successfully, but these errors were encountered: