removeUserTasks method

Future<void> removeUserTasks([
  1. Study<PrimaryDeviceDeployment>? study
])

Remove the list of user tasks for study. If study is null, all user tasks are removed.

Implementation

Future<void> removeUserTasks([Study? study]) async {
  info("$runtimeType - Erasing user tasks for study: $study");
  try {
    await _database?.delete(
      TASK_QUEUE_TABLE_NAME,
      where: study != null
          ? '$STUDY_DEPLOYMENT_ID_COLUMN = ? AND $DEVICE_ROLE_NAME_COLUMN = ?'
          : null,
      whereArgs: study != null
          ? [study.studyDeploymentId, study.deviceRoleName]
          : null,
    );
  } catch (exception) {
    warning('$runtimeType - Failed to erase deployment - $exception');
  }
}