Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clear selection after submit #82

Merged
merged 1 commit into from
May 24, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,7 @@ export class ChooseEventsComponent implements OnInit {
}).subscribe(participant => {
this.participants.unshift(participant);
this.updateHelpers();
this.clearSelection();
});
}

Expand Down Expand Up @@ -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;
Expand All @@ -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);
}
Expand Down