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

Ability to control display order in CareCard/SymptomTracker #51

Closed
heptal opened this issue May 20, 2016 · 4 comments
Closed

Ability to control display order in CareCard/SymptomTracker #51

heptal opened this issue May 20, 2016 · 4 comments

Comments

@heptal
Copy link

heptal commented May 20, 2016

It would be nice if there were a straightforward way to control display order in OCKSymptomTrackerViewController/OCKSymptomTrackerViewController.

The :willDisplayEvents:dateComponents: delegate methods allow changes to the events themselves associated with the OCKCarePlanStore used in initialization. The displayed data is ultimately populated using that store with [_tableView reloadData]. The display order is determined by the order in which the activities were added to the OCKCarePlanStore.

Is OCKCarePlanStore intended to be the persistent single source of truth for CareKit apps?

Ways around this include creating a parallel database that serves as the authoritative data source, and creating and populating new OCKCarePlanStores from that for the view controllers. This works but creates a lot of parallel work and may impact performance. One could also (this is a terrible idea) fetch the activities and their associated events, remove and re-add the activities in the desired order, and reconstruct the events for each activity using OCKCarePlanStore API methods.

Straightforward solutions may include adding a displayOrder field to the CoreData model (seems polluting to the model). Alternatively, the OCKCarePlanStore could expose its NSManagedObjectContext, allowing the creation of a CoreData hierarchy as described here. This way, a 'parent' store would control the persistence/writes and be the source of truth, and 'child' OCKCarePlanStores could be created and populated for the view controllers on-demand, populated with the subsets of relevant data in whatever order. Event changes in the child contexts would be passed to the 'parent' for persistence to disk. Does this seem reasonable?

Any suggestions are appreciated.

@YuanZhu-apple
Copy link
Contributor

A delegate method with sorting capability for OCKSymptomTrackerViewController/OCKSymptomTrackerViewController
Do you think it is a clean way to control the display order?

@heptal
Copy link
Author

heptal commented May 24, 2016

That would be fine. Ability to suppress/hide activities would be desirable there as well.

Perhaps controlled in the delegate by having the delegate method given a param with an array of activity identifier, respecting the order and presence of IDs in the array?

@ninoguba
Copy link
Contributor

@heptal The events displayed on the CareCard/SymptomTracker are stored in an array that is used by the UITableViewDataSource. In #57 I was able to modify the grouping and order of the "events" displayed by adding my own sub-arrays and implemented the necessary delegate methods to display/select the corresponding section headers and cells.

No need to modify or duplicate some of the functions of the OCKCarePlanStore and it shall remain the single source of truth.

@Pariecemckinney-apple
Copy link
Collaborator

Closing due to inactivity. Please feel free to reopen if you would like the conversation to continue.

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

No branches or pull requests

4 participants