From 81f88f10f81774aa219b44d63a6fa0e992e3da0f Mon Sep 17 00:00:00 2001 From: Dimas Wiese Date: Mon, 16 Mar 2026 00:55:03 +0100 Subject: [PATCH] Refactor toggleShowResults method to persist showResultsToParticipants flag correctly --- src/app/pages/survey-detail/survey-detail.page.ts | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) 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; } // -------------------------------------------------------------------------