From 81e8b7dd12a8aac76a2efa455c27cce29efdc52a Mon Sep 17 00:00:00 2001 From: LZRS <12814349+LZRS@users.noreply.github.com> Date: Wed, 18 Sep 2024 11:49:20 +0300 Subject: [PATCH] Use dipatcher IO to handle questionnaire submission --- .../fhircore/quest/ui/questionnaire/QuestionnaireViewModel.kt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/android/quest/src/main/java/org/smartregister/fhircore/quest/ui/questionnaire/QuestionnaireViewModel.kt b/android/quest/src/main/java/org/smartregister/fhircore/quest/ui/questionnaire/QuestionnaireViewModel.kt index 472effbc78..33c108e27f 100644 --- a/android/quest/src/main/java/org/smartregister/fhircore/quest/ui/questionnaire/QuestionnaireViewModel.kt +++ b/android/quest/src/main/java/org/smartregister/fhircore/quest/ui/questionnaire/QuestionnaireViewModel.kt @@ -166,7 +166,7 @@ constructor( context: Context, onSuccessfulSubmission: (List, QuestionnaireResponse) -> Unit, ) { - viewModelScope.launch(SupervisorJob()) { + viewModelScope.launch(dispatcherProvider.io() + SupervisorJob()) { val questionnaireResponseValid = validateQuestionnaireResponse( questionnaire = questionnaire, @@ -672,7 +672,7 @@ constructor( * has an answer. */ fun saveDraftQuestionnaire(questionnaireResponse: QuestionnaireResponse) { - viewModelScope.launch { + viewModelScope.launch(dispatcherProvider.io()) { val questionnaireHasAnswer = questionnaireResponse.item.any { it.answer.any { answerComponent -> answerComponent.hasValue() }