From 09d4e4d3fafb13d84b24890963aa230e38d2fa19 Mon Sep 17 00:00:00 2001 From: Julian Holfeld Date: Tue, 23 May 2023 16:30:16 +0200 Subject: [PATCH] feat: clearSelection --- .../src/app/poll/choose-events/choose-events.component.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/frontend/src/app/poll/choose-events/choose-events.component.ts b/apps/frontend/src/app/poll/choose-events/choose-events.component.ts index f2ac47fb..4ff18d04 100644 --- a/apps/frontend/src/app/poll/choose-events/choose-events.component.ts +++ b/apps/frontend/src/app/poll/choose-events/choose-events.component.ts @@ -120,6 +120,7 @@ export class ChooseEventsComponent implements OnInit { }).subscribe(participant => { this.participants.unshift(participant); this.updateHelpers(); + this.clearSelection(); }); } @@ -204,7 +205,6 @@ export class ChooseEventsComponent implements OnInit { // Helpers private updateHelpers() { - this.bestOption = Math.max(...this.pollEvents.map(event => this.countParticipants(event))) || 1; const deadline = this.poll?.settings.deadline; @@ -221,6 +221,11 @@ export class ChooseEventsComponent implements OnInit { } } + private clearSelection(){ + this.name = ''; + this.checks = new Array(this.checks.length).fill(CheckboxState.FALSE); + } + private filterEvents(checks: CheckboxState[], state: CheckboxState) { return this.pollEvents.filter((_, i) => checks[i] === state).map(e => e._id); }