[Office Hours] Shadowing Previous Outcomes for an updated Task #147
-
In what area do you have a technical challenge?Spezi Scheduler DescriptionI’m working on a feature that notifies users if they haven’t recorded lab values for 7 days. This morning at 9 AM, I received a notification, and after entering a lab result, I closed and reopened the app. Upon relaunching, and open the schedule tab, I encountered the following error (the error won't show if I didn't open the schedule tab): I checked the Spezi Scheduler repository and found that this error might occur in the I’m wondering:
PR linked to the notification function. ReproductionHere’s how I implemented it:
Expected behaviorNo error. Additional contextNo response Code of Conduct
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 13 replies
-
@lukaskollmer @PSchmiedmayer Hi! Could you take a look at this? This error occurs on my phone, and I can't reproduce it on the simulator (I don't know why)... |
Beta Was this translation helpful? Give feedback.
-
try specifying what this does is that when trying to update a task in a way that would cause issues with existing data that exist for upcoming event outcomes[^1], it will delete these upcoming outcomes, which allows you to update the task. the reason why it probably seems to work fine in the simulator is because there's a longstanding SwiftData bug whereby changes to the ModelContext aren't auto-saved when running in the simulator. (when running on a real device, the autsave feature will work fine.) also maybe have a look at my comment here, which goes into a little bit of detail regarding the different components of the Scheduler module, and how they interplay with each other; this should help explaining why there is a need in the first place to deal with potential shadowing of upcoming events/outcomes. [^1] what does "upcoming event outcomes" mean? imagine having a task that is scheduled daily (ie, has one event per day), and you mark some of the upcoming events as completed. if you now change the task to have a weekly schedule, the database would still contain these completed daily events for the upcoming days. but they wouldn't match the task's schedule anymore. the option allows you to essentially tell the |
Beta Was this translation helpful? Give feedback.
i attemped to fix this in StanfordSpezi/SpeziScheduler#61. feel free to change the SpeziScheduler dependency in your app to the
lukas/improve-shadowed-outcome-handling
branch and give it a try 🚀