diff --git a/src/app/components/counter-selection/counter-selection.component.html b/src/app/components/counter-selection/counter-selection.component.html
index dcad043..021b2e8 100644
--- a/src/app/components/counter-selection/counter-selection.component.html
+++ b/src/app/components/counter-selection/counter-selection.component.html
@@ -6,10 +6,13 @@
Geen
@for (player of data.availableCounters; track player.playerId) {
-
+
{{ player.name }}
}
+
+ Invalteller
+
diff --git a/src/app/components/counter-selection/counter-selection.component.ts b/src/app/components/counter-selection/counter-selection.component.ts
index a2e089d..c19454d 100644
--- a/src/app/components/counter-selection/counter-selection.component.ts
+++ b/src/app/components/counter-selection/counter-selection.component.ts
@@ -33,7 +33,8 @@ import {FormsModule} from "@angular/forms";
})
export class CounterSelectionComponent {
- counter: TournamentPlayer;
+ // counter: TournamentPlayer;
+ counter: number;
readonly dialogRef = inject(MatDialogRef);
diff --git a/src/app/components/match-result/match-result.component.ts b/src/app/components/match-result/match-result.component.ts
index b9fbbc7..9dffdc8 100644
--- a/src/app/components/match-result/match-result.component.ts
+++ b/src/app/components/match-result/match-result.component.ts
@@ -90,7 +90,6 @@ export class MatchResultComponent {
}
complementScores() {
- // console.log("in complementScores");
}
validateResult(): void {
diff --git a/src/app/components/tournament-manage/tournament-manage.component.ts b/src/app/components/tournament-manage/tournament-manage.component.ts
index 2ee3476..ea425b1 100644
--- a/src/app/components/tournament-manage/tournament-manage.component.ts
+++ b/src/app/components/tournament-manage/tournament-manage.component.ts
@@ -35,7 +35,7 @@ import {TournamentPlayersComponent} from "../tournament-players/tournament-playe
import {TournamentPlayer} from "../../model/tournamentPlayer";
import {TeamDisplayComponent} from "../team-display/team-display.component";
import {CounterSelectionComponent} from "../counter-selection/counter-selection.component";
-import {Observable, Subscription, tap} from "rxjs";
+import {Observable, Subscription} from "rxjs";
import {MatTooltip} from '@angular/material/tooltip';
@Component({
@@ -209,45 +209,27 @@ export class TournamentManageComponent implements OnInit, OnDestroy {
}
matchContainsPlayersThatArePlaying(match: Match): boolean {
- let matchPlayers: number[] = [];
- matchPlayers.push(this.getPlayerOrSubstitute(match.team1.player1, match.type).id);
- if (match.team1.player2) matchPlayers.push(this.getPlayerOrSubstitute(match.team1.player2, match.type).id);
- matchPlayers.push(this.getPlayerOrSubstitute(match.team2.player1, match.type).id);
- if (match.team2.player2) matchPlayers.push(this.getPlayerOrSubstitute(match.team2.player2, match.type).id);
+ const matchPlayers = this.getMatchPlayers(match);
let matchPlayersThatArePlaying = this.tournament.playersPlaying.filter(Set.prototype.has, new Set(matchPlayers));
return matchPlayersThatArePlaying.length > 0;
}
matchPlayersThatArePlaying(match: Match): number[] {
- let matchPlayers: number[] = [];
-
- matchPlayers.push(this.getPlayerOrSubstitute(match.team1.player1, match.type).id);
- if (match.team1.player2) matchPlayers.push(this.getPlayerOrSubstitute(match.team1.player2, match.type).id);
- matchPlayers.push(this.getPlayerOrSubstitute(match.team2.player1, match.type).id);
- if (match.team2.player2) matchPlayers.push(this.getPlayerOrSubstitute(match.team2.player2, match.type).id);
+ const matchPlayers = this.getMatchPlayers(match);
return this.tournament.playersPlaying.filter(Set.prototype.has, new Set(matchPlayers));
}
matchContainsPlayersThatAreCounting(match: Match): boolean {
- let matchPlayers: number[] = [];
- matchPlayers.push(this.getPlayerOrSubstitute(match.team1.player1, match.type).id);
- if (match.team1.player2) matchPlayers.push(this.getPlayerOrSubstitute(match.team1.player2, match.type).id);
- matchPlayers.push(this.getPlayerOrSubstitute(match.team2.player1, match.type).id);
- if (match.team2.player2) matchPlayers.push(this.getPlayerOrSubstitute(match.team2.player2, match.type).id);
+ const matchPlayers = this.getMatchPlayers(match);
let matchPlayersThatAreCounting = this.tournament.playersCounting.filter(Set.prototype.has, new Set(matchPlayers));
return matchPlayersThatAreCounting.length > 0;
}
matchPlayersThatAreCounting(match: Match): number[] {
- let matchPlayers: number[] = [];
-
- matchPlayers.push(this.getPlayerOrSubstitute(match.team1.player1, match.type).id);
- if (match.team1.player2) matchPlayers.push(this.getPlayerOrSubstitute(match.team1.player2, match.type).id);
- matchPlayers.push(this.getPlayerOrSubstitute(match.team2.player1, match.type).id);
- if (match.team2.player2) matchPlayers.push(this.getPlayerOrSubstitute(match.team2.player2, match.type).id);
+ const matchPlayers = this.getMatchPlayers(match);
return this.tournament.playersCounting.filter(Set.prototype.has, new Set(matchPlayers));
}
@@ -280,18 +262,25 @@ export class TournamentManageComponent implements OnInit, OnDestroy {
return courts.filter(court => activeCourts.indexOf(court) < 0);
}
- getAvailableCounters(match: Match): TournamentPlayer[] {
+ getMatchPlayers(match: Match): number[] {
const matchPlayers: number[] = [];
matchPlayers.push(this.getPlayerOrSubstitute(match.team1.player1, match.type).id);
if (match.team1.player2) matchPlayers.push(this.getPlayerOrSubstitute(match.team1.player2, match.type).id);
matchPlayers.push(this.getPlayerOrSubstitute(match.team2.player1, match.type).id);
if (match.team2.player2) matchPlayers.push(this.getPlayerOrSubstitute(match.team2.player2, match.type).id);
+ return matchPlayers;
+ }
+
+ getAvailableCounters(match: Match): TournamentPlayer[] {
+ const matchPlayers = this.getMatchPlayers(match);
+
const counterIds = this.tournament.playersAvailable.filter(player => !matchPlayers.includes(player));
return counterIds.map(id => this.getTournamentPlayerFromId(id));
}
+
getPlayerOrSubstitute(player: Player, type: String): TournamentPlayer {
return this.getSubstituteForEvent(player, type) || this.getTournamentPlayerFromPlayer(player);
}
@@ -441,7 +430,7 @@ export class TournamentManageComponent implements OnInit, OnDestroy {
minHeight: '250px'
}).afterClosed().subscribe(result => {
if (result != undefined) {
- this.loadTournament(this.tournamentService.updateCounter(this.tournament.id, match.id, result.counter.playerId));
+ this.loadTournament(this.tournamentService.updateCounter(this.tournament.id, match.id, result.counter));
}
});
diff --git a/src/app/pipes/fullname-pipe.ts b/src/app/pipes/fullname-pipe.ts
index 115e15b..a53dfd7 100644
--- a/src/app/pipes/fullname-pipe.ts
+++ b/src/app/pipes/fullname-pipe.ts
@@ -8,7 +8,7 @@ export class FullNamePipe implements PipeTransform {
if (person) {
return [person.firstName, person.middleName, person.lastName].filter(Boolean).join(" ");
} else {
- return "";
+ return "Invalteller";
}
}
}