Skip to content

Commit

Permalink
Merge pull request #82 from Morphclue/feat/clear-selection
Browse files Browse the repository at this point in the history
Clear selection after submit
  • Loading branch information
Clashsoft authored May 24, 2023
2 parents 50a1ca9 + 09d4e4d commit 37f5af9
Showing 1 changed file with 6 additions and 1 deletion.
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

0 comments on commit 37f5af9

Please sign in to comment.