Skip to content
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

allow activities to be discontinued. refs #71 #80

Closed
wants to merge 3 commits into from

Conversation

dukemike
Copy link

@dukemike dukemike commented Jul 1, 2016

No description provided.

@scdi
Copy link

scdi commented Jul 1, 2016

Hi:
How does an app allow users to add OCKCarePlanActivity? Is there some code sample available?

@dukemike
Copy link
Author

dukemike commented Jul 1, 2016

@scdi OCKCareCardViewController does not currently support adding an activity, but I know that the folks at Apple have discussed it. I'm working on something that will likely need it and will definitely submit it if I do. That said, if you're looking for a hack, you could add another bar button item to the care card view controller. That would allow you to present your own view controller to create an OCKCarePlanActivity.

@@ -474,6 +474,20 @@ - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath
}


- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath {
OCKCarePlanActivity *selectedActivity = _events[indexPath.row].firstObject.activity;
OCKCarePlanEvent *event = _events[indexPath.row].firstObject;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Refactor to:

OCKCarePlanEvent *event = _events[indexPath.row].firstObject;
OCKCarePlanActivity *activity = event.activity;

@umerkhan-apple
Copy link
Contributor

umerkhan-apple commented Jul 1, 2016

@dukemike Minor nits. Overall looks great! 👍

The Discontinue Button shows up even after the user has tapped to discontinue the activity.
Also, could you update the Test App as well to include this use-case?

@YuanZhu-apple Could you also take a look? :)

@dukemike
Copy link
Author

dukemike commented Jul 6, 2016

@umerkhan-apple, @YuanZhu-apple Please review. Thanks!


@param viewController The view controller providing the callback.
@param interventionActivity The intervention activity that the user selected.
*/
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update documentation to state that the discontinue will happen after "today's" date. And this is only applicable to the current day. If the user goes back to a previous day, they cannot mark it to be discontinued.

@umerkhan-apple
Copy link
Contributor

umerkhan-apple commented Aug 18, 2016

@dukemike Looks great. Thanks for the updating the test app as well.

One thing that is still not fixed is that the user can go back to a previous day, and swipe left on an activity to discontinue it.
The discontinue button should only be available for activities on today's date.

Apart from that the PR looks great. Once that fix is in, this one is good to be merged.

@dukemike
Copy link
Author

Being able to discontinue an activity on a prior day is something that I'd like to allow. Could preventing discontinuation in the past be enforced by the developer vs the framework? I can imagine the case where the user stopped performing an activity yesterday but didn't open the app to discontinue it then.

@umerkhan-apple
Copy link
Contributor

@dukemike Ah that use-case definitely make sense. My concern is that there is no way to allow the developer to discontinue in the past or not. The delegate callback provides the Activity.

One bad path is:
Let's say today is Friday. The user completes Outdoor Walk. Then goes back to Wednesday and discontinues Outdoor Walk. That seems like an error-prone state.

Any creative ideas on how we can go around this?

@umerkhan-apple
Copy link
Contributor

Also, one other thing I thought of. Could we just have the button say Discontinue, and when the user taps it, just set the endDate to be yesterday?

@dukemike
Copy link
Author

@umerkhan-apple The idea of checking for future completed events for an activity to determine if the discontinue should be shown sounds both problematic and non-performant. How about if a user tries to discontinue and there are future completed events then: the activity's completion date could be set to after the last completed event, or the user could be asked if they want to delete the future ones? I lean towards asking the user.

re: the discontinuation text / date, my preference is that discontinuation is something that end the activity and does not remove it from view because it feels less like Delete to me, but I'm not tied to it and don't have any major concerns if we set the endDate to yesterday. "Delete" and "Discontinue after today" feel clear to me, while "Discontinue" feels less so, but I agree that it is really wordy.

@tktsubota
Copy link
Contributor

I played with this a little bit, and I think it's a great addition (next up is adding activities!) However, I do think that in addition to having it available on swipe, it should be available on the default detail view controller of interventions (assuming the delegate method is implemented).

As for the naming, "Discontinue After Today" is quite long (more than half the width on iPhone 6s). I was thinking maybe "End Today" or "Discontinue" like what @umerkhan-apple said.

As for the error case, there are one of two ways we could go about this:

  1. No matter which day is being viewed, discontinuing it would set the end date to today. This seems slightly unintuitive, but changing the title to "Discontinue Today" or "End Today" might work.
  2. Discontinue on the day being viewed, and gracefully handle the error if necessary (I'm really not sure how often this particular case will occur). I'm thinking an alert saying "Data after date being viewed for this activity will be lost". There, "OK" or "Cancel" buttons can be provided.

@umerkhan-apple
Copy link
Contributor

@dukemike I think for the wording, it would make sense to just say Discontinue and have the functionality be that it sets the endDate to be the previous date (or whatever the last date for that activity was). This use-case makes more sense to me, because mostly users will not know ahead of time if they are discontinue for tomorrow or not. For example, when they see a med on their Care Card today, they will want to hit discontinue because they know they are no longer taking it. They won't really hit discontinue because they know they won't be taking it starting tomorrow.

This really gets tricky if it is something that is only once a month. So on the first of every month, they go for physical therapy. Then when they complete that task, they know they will no longer be repeating it the following month, but most likely users won't remember to mark it as discontinue. Cause they will have already logged it as something that they have done. Come next month, they see the activity again. Now if they mark it as discontinued, it won't show up the following month, but it still will for the current month. At this point, they will have to go back to the previous month's activity, and mark that as discontinued.

This approach seems very counter-intuivite. I think we should just have the button say Discontinue and mark whenever the last time the activity occurred as the end date.

For the case where they are going back in time to discontinue something, we can show them an alert confirming that they will lose all the data from that day onwards. If they confirm, then we set the end date and make sure that no data is stored past that end date for the activity.

@scdi
Copy link

scdi commented Aug 22, 2016

That seems very reasonable to me. That is a good approach.

Sent from my iPhone

On Aug 22, 2016, at 1:26 PM, Umer Khan notifications@github.com wrote:

@dukemike I think for the wording, it would make sense to just say Discontinue and have the functionality be that it sets the endDate to be the previous date (or whatever the last date for that activity was). This use-case makes more sense to me, because mostly users will not know ahead of time if they are discontinue for tomorrow or not. For example, when they see a med on their Care Card today, they will want to hit discontinue because they know they are no longer taking it. They won't really hit discontinue because they know they won't be taking it starting tomorrow.

This really gets tricky if it is something that is only once a month. So on the first of every month, they go for physical therapy. Then when they complete that task, they know they will no longer be repeating it the following month, but most likely users won't remember to mark it as discontinue. Cause they will have already logged it as something that they have done. Come next month, they see the activity again. Now if they mark it as discontinued, it won't show up the following month, but it still will for the current month. At this point, they will have to go back to the previous month's activity, and mark that as discontinued.

This approach seems very counter-intuivite. I think we should just have the button say Discontinue and mark whenever the last time the activity occurred as the end date.

For the case where they are going back in time to discontinue something, we can show them an alert confirming that they will lose all the data from that day onwards. If they confirm, then we set the end date and make sure that no data is stored past that end date for the activity.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub, or mute the thread.

@dukemike
Copy link
Author

Sounds good. I'll set the endDate to the previous date and make the other changes.

@srinathtm-apple
Copy link
Collaborator

Closing this PR as it is no longer relevant due to CareKit 2.0 beta update, however we are discussing internally to provide support for discontinuing tasks...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants