updateStudy method

Future<bool> updateStudy(
  1. SmartphoneStudy study
)

Update the study persistently to a local cache. Returns true if successful.

Implementation

Future<bool> updateStudy(SmartphoneStudy study) async {
  bool success = true;
  try {
    await _database?.update(
      STUDY_TABLE_NAME,
      _getMap(study),
      where:
          '$STUDY_DEPLOYMENT_ID_COLUMN = ? AND '
          '$DEVICE_ROLE_NAME_COLUMN = ?',
      whereArgs: [study.studyDeploymentId, study.deviceRoleName],
      conflictAlgorithm: ConflictAlgorithm.replace,
    );
    debug('$runtimeType - Updated study - $study');
  } catch (exception) {
    success = false;
    warning('$runtimeType - Failed to update study - $exception');
  }
  return success;
}