forked from quic-issues/427e7578-d7bf-49c8-aee9-2dd999e25316
Refactor toggleShowResults method to persist showResultsToParticipants flag correctly
This commit is contained in:
@@ -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<void> {
|
||||
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<void> {
|
||||
if (!this.survey) return;
|
||||
await this.surveyService.updateSurvey(this.surveyId, { status });
|
||||
this.survey.status = status;
|
||||
}
|
||||
|
||||
// -------------------------------------------------------------------------
|
||||
|
||||
Reference in New Issue
Block a user