diff --git a/src/app/components/player-registrations/player-registrations.component.ts b/src/app/components/player-registrations/player-registrations.component.ts index 7d39553..3e8a4cd 100644 --- a/src/app/components/player-registrations/player-registrations.component.ts +++ b/src/app/components/player-registrations/player-registrations.component.ts @@ -101,13 +101,19 @@ export class PlayerRegistrationsComponent implements OnInit { } getRelevantPlayers(type: string): Player[] { + let players: Player[]; if ( (this.player.sex == 'M' && type == 'HD') || (this.player.sex == 'V' && type == 'GD') ) { - return this.allPlayers.filter(player => player.sex == 'M' && player.id != this.player.id); + players = this.allPlayers.filter(player => player.sex == 'M' && player.id != this.player.id); } else { - return this.allPlayers.filter(player => player.sex == 'V' && player.id != this.player.id); + players = this.allPlayers.filter(player => player.sex == 'V' && player.id != this.player.id); } + + return players.sort((a, b) => + a.lastName < b.lastName ? -1 : + b.lastName < a.lastName ? 1 : + a.firstName < b.firstName ? -1 : 1); } @@ -121,5 +127,4 @@ export class PlayerRegistrationsComponent implements OnInit { protected readonly Player = Player; protected readonly EventRegistration = EventRegistration; - protected readonly TournamentRegistration = TournamentRegistration; }