Coder Social home page Coder Social logo

Comments (6)

umerkhan-apple avatar umerkhan-apple commented on July 3, 2024

https://github.com/carekit-apple/CareKit/blob/master/CareKit/CareCard/OCKCareCardViewController.h#L57
You can use that method in the delegate to manually control the event completion.

from carekit.

ninoguba avatar ninoguba commented on July 3, 2024

Umer,

I'm returning NO for that delegate method already and implemented my own custom logic upon completion of the task presented. This works as expected.

The issue I found is when the activity has been completed already (circle filled). The moment you tap the completed circle, the fill is cleared right before the activity task gets presented. Because they've completed the task before, they don't need to complete it anymore. The problem is for the circle to be back to filled status, they'll have to complete the whole task again.

Since I've implemented shouldHandleEventCompletionForActivity to return NO I expected to have complete control of the activity completion states but that clearly is still not the case.

from carekit.

ninoguba avatar ninoguba commented on July 3, 2024

Also noticed the corresponding OCKCarePlanEvent's state for the circle stays .Completed (if it was completed before) while the circle on the CareCard is not filled in this subsequent tap scenario.

from carekit.

ninoguba avatar ninoguba commented on July 3, 2024

To workaround this issue, I added a conditional check in my ORKTaskViewController's didFinishWithReason delegate, that regardless of the reason (.Completed or .Discarded), if the OCKCarePlanEvent's state was already .Completed then I just update the store again with the .Completed state and this keeps the completed circles filled. A little redundant but it works for now.

Thinking ahead though, this might skew the data for the Insights.

from carekit.

umerkhan-apple avatar umerkhan-apple commented on July 3, 2024

@ninoguba Your approach is correct. You should override the delegate that disables automatic updating of events, and then use your logic to update the state of the event.

from carekit.

ninoguba avatar ninoguba commented on July 3, 2024

The problem is the subsequent updates to the state of the event that gets stored in the CarePlanStore. The user really only completed the activity once but on the store it may appear to be completed several times. Depending on the use case, this approach may or may not work.

from carekit.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.