diff --git a/src/app/pages/survey-detail/survey-detail.page.ts b/src/app/pages/survey-detail/survey-detail.page.ts index ae576a5..0ca7b8e 100644 --- a/src/app/pages/survey-detail/survey-detail.page.ts +++ b/src/app/pages/survey-detail/survey-detail.page.ts @@ -109,20 +109,17 @@ export class SurveyDetailPage implements OnInit, OnDestroy { // Settings // ------------------------------------------------------------------------- - /** Toggle and persist the showResultsToParticipants flag */ + /** Persist the showResultsToParticipants flag after ngModel has updated it */ async toggleShowResults(): Promise { if (!this.survey) return; - const newValue = !this.survey.showResultsToParticipants; await this.surveyService.updateSurvey(this.surveyId, { - showResultsToParticipants: newValue, + showResultsToParticipants: this.survey.showResultsToParticipants, }); - this.survey.showResultsToParticipants = newValue; } async changeSurveyStatus(status: Survey['status']): Promise { if (!this.survey) return; await this.surveyService.updateSurvey(this.surveyId, { status }); - this.survey.status = status; } // -------------------------------------------------------------------------