deleteProgress method
Implementation
Future<void> deleteProgress() async {
try {
await env.client
.from(SubjectProgress.tableName)
.delete()
.eq('subject_id', id);
} catch (error, stacktrace) {
SupabaseQuery.catchSupabaseException(error, stacktrace);
rethrow;
}
// Filter out all multimodal answers and remove their paths from the blob storage
final observationPaths = progress
.where((p) => p.result.result is QuestionnaireState)
.map((p) => (p.result.result as QuestionnaireState).answers.values)
.expand((answers) => answers)
.where(
(e) =>
e.question == AudioRecordingQuestion.questionType ||
e.question == ImageCapturingQuestion.questionType,
)
.map((e) => e.response!.toString())
.toList();
if (observationPaths.isNotEmpty) {
BlobStorageHandler().removeObservation(observationPaths);
}
}