Sort partners
This commit is contained in:
@@ -101,13 +101,19 @@ export class PlayerRegistrationsComponent implements OnInit {
|
|||||||
}
|
}
|
||||||
|
|
||||||
getRelevantPlayers(type: string): Player[] {
|
getRelevantPlayers(type: string): Player[] {
|
||||||
|
let players: Player[];
|
||||||
if ( (this.player.sex == 'M' && type == 'HD') ||
|
if ( (this.player.sex == 'M' && type == 'HD') ||
|
||||||
(this.player.sex == 'V' && type == 'GD')
|
(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 {
|
} 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 Player = Player;
|
||||||
protected readonly EventRegistration = EventRegistration;
|
protected readonly EventRegistration = EventRegistration;
|
||||||
protected readonly TournamentRegistration = TournamentRegistration;
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user