completedTaskForDay method

bool completedTaskForDay(
  1. String taskId,
  2. DateTime dateTime
)

Check if a task is fully completed for all task instances returns true if a given task has been completed for all of its completionPeriods on a given day

Implementation

bool completedTaskForDay(String taskId, DateTime dateTime) {
  return [
    ...selectedInterventions.expand((e) => e.tasks),
    ...study.observations,
  ].where((task) => task.id == taskId).single.schedule.completionPeriods.any(
        (period) => completedTaskInstanceForDay(taskId, period, dateTime),
      );
}