-
Notifications
You must be signed in to change notification settings - Fork 444
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
percentage of completed tasks #666
Comments
You can do it using OCKAdherenceQuery. If successful, adherence queries return one of three values: For example: let store = OCKStore("MyStore")
func fetchAdherence(for date: Date) {
let startOfDay = Calendar.current.startOfDay(for: date)
let endOfDay = Calendar.current.date(bySettingHour: 23, minute: 59, second: 59, of: date)!
var query = OCKAdherenceQuery(
taskIDs: [], // If you want adherence for all tasks. You can add task IDs if you want to check adherence for specific tasks
dateInterval: DateInterval(start: startOfDay, end: endOfDay)
)
query.aggregator = OCKAdherenceAggregator.compareTargetValues
store.fetchAdherence(query: query) { result in
switch result {
case .success(let adherence):
switch adherence[0] {
case .noTasks:
// handle no tasks
case .noEvents:
// handle no events
case .progress(let double):
let percentage = double * 100
// handle that
}
case .failure(let error):
// handle the error
}
}
} Hope this helps! |
Thanks a lot! |
Hello @ykworld, I also want to add the OverView section to my app. Can you please guide me on how you append that section to the view? Thanks,
|
I want to get the percentage of completed tasks. How can I implement it?
The text was updated successfully, but these errors were encountered: