Use non-player counters
Gitea/swiss-client/pipeline/head This commit looks good

This commit is contained in:
michel committed 2026-10-29 18:57:00 +01:00
1 parent 87d9291bfb
commit 673f9f1706
5 files changed
+21 -29

No files matched your search

@@ -6,10 +6,13 @@
<mat-select [(ngModel)]="counter">
<mat-option>Geen</mat-option>
@for (player of data.availableCounters; track player.playerId) {
<mat-option [value]="player">
<mat-option [value]="player.playerId">
{{ player.name }}
</mat-option>
}
<mat-option [value]="999999">
Invalteller
</mat-option>
</mat-select>
</mat-form-field>
</div>
@@ -33,7 +33,8 @@ import {FormsModule} from "@angular/forms";
})
export class CounterSelectionComponent {
counter: TournamentPlayer;
// counter: TournamentPlayer;
counter: number;
readonly dialogRef = inject(MatDialogRef<CounterSelectionComponent>);
@@ -90,7 +90,6 @@ export class MatchResultComponent {
}
complementScores() {
// console.log("in complementScores");
}
validateResult(): void {
@@ -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));
}
});
+1 -1
View File
@@ -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";
}
}
}