This commit is contained in:
1 parent
87d9291bfb
commit
673f9f1706
5 files changed
+21
-29
No files matched your search
@@ -6,10 +6,13 @@
|
|||||||
<mat-select [(ngModel)]="counter">
|
<mat-select [(ngModel)]="counter">
|
||||||
<mat-option>Geen</mat-option>
|
<mat-option>Geen</mat-option>
|
||||||
@for (player of data.availableCounters; track player.playerId) {
|
@for (player of data.availableCounters; track player.playerId) {
|
||||||
<mat-option [value]="player">
|
<mat-option [value]="player.playerId">
|
||||||
{{ player.name }}
|
{{ player.name }}
|
||||||
</mat-option>
|
</mat-option>
|
||||||
}
|
}
|
||||||
|
<mat-option [value]="999999">
|
||||||
|
Invalteller
|
||||||
|
</mat-option>
|
||||||
</mat-select>
|
</mat-select>
|
||||||
</mat-form-field>
|
</mat-form-field>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -33,7 +33,8 @@ import {FormsModule} from "@angular/forms";
|
|||||||
})
|
})
|
||||||
export class CounterSelectionComponent {
|
export class CounterSelectionComponent {
|
||||||
|
|
||||||
counter: TournamentPlayer;
|
// counter: TournamentPlayer;
|
||||||
|
counter: number;
|
||||||
|
|
||||||
readonly dialogRef = inject(MatDialogRef<CounterSelectionComponent>);
|
readonly dialogRef = inject(MatDialogRef<CounterSelectionComponent>);
|
||||||
|
|
||||||
|
|||||||
@@ -90,7 +90,6 @@ export class MatchResultComponent {
|
|||||||
}
|
}
|
||||||
|
|
||||||
complementScores() {
|
complementScores() {
|
||||||
// console.log("in complementScores");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
validateResult(): void {
|
validateResult(): void {
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ import {TournamentPlayersComponent} from "../tournament-players/tournament-playe
|
|||||||
import {TournamentPlayer} from "../../model/tournamentPlayer";
|
import {TournamentPlayer} from "../../model/tournamentPlayer";
|
||||||
import {TeamDisplayComponent} from "../team-display/team-display.component";
|
import {TeamDisplayComponent} from "../team-display/team-display.component";
|
||||||
import {CounterSelectionComponent} from "../counter-selection/counter-selection.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';
|
import {MatTooltip} from '@angular/material/tooltip';
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
@@ -209,45 +209,27 @@ export class TournamentManageComponent implements OnInit, OnDestroy {
|
|||||||
}
|
}
|
||||||
|
|
||||||
matchContainsPlayersThatArePlaying(match: Match): boolean {
|
matchContainsPlayersThatArePlaying(match: Match): boolean {
|
||||||
let matchPlayers: number[] = [];
|
const matchPlayers = this.getMatchPlayers(match);
|
||||||
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);
|
|
||||||
|
|
||||||
let matchPlayersThatArePlaying = this.tournament.playersPlaying.filter(Set.prototype.has, new Set(matchPlayers));
|
let matchPlayersThatArePlaying = this.tournament.playersPlaying.filter(Set.prototype.has, new Set(matchPlayers));
|
||||||
return matchPlayersThatArePlaying.length > 0;
|
return matchPlayersThatArePlaying.length > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
matchPlayersThatArePlaying(match: Match): number[] {
|
matchPlayersThatArePlaying(match: Match): number[] {
|
||||||
let matchPlayers: number[] = [];
|
const matchPlayers = this.getMatchPlayers(match);
|
||||||
|
|
||||||
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 this.tournament.playersPlaying.filter(Set.prototype.has, new Set(matchPlayers));
|
return this.tournament.playersPlaying.filter(Set.prototype.has, new Set(matchPlayers));
|
||||||
}
|
}
|
||||||
|
|
||||||
matchContainsPlayersThatAreCounting(match: Match): boolean {
|
matchContainsPlayersThatAreCounting(match: Match): boolean {
|
||||||
let matchPlayers: number[] = [];
|
const matchPlayers = this.getMatchPlayers(match);
|
||||||
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);
|
|
||||||
|
|
||||||
let matchPlayersThatAreCounting = this.tournament.playersCounting.filter(Set.prototype.has, new Set(matchPlayers));
|
let matchPlayersThatAreCounting = this.tournament.playersCounting.filter(Set.prototype.has, new Set(matchPlayers));
|
||||||
return matchPlayersThatAreCounting.length > 0;
|
return matchPlayersThatAreCounting.length > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
matchPlayersThatAreCounting(match: Match): number[] {
|
matchPlayersThatAreCounting(match: Match): number[] {
|
||||||
let matchPlayers: number[] = [];
|
const matchPlayers = this.getMatchPlayers(match);
|
||||||
|
|
||||||
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 this.tournament.playersCounting.filter(Set.prototype.has, new Set(matchPlayers));
|
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);
|
return courts.filter(court => activeCourts.indexOf(court) < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
getAvailableCounters(match: Match): TournamentPlayer[] {
|
getMatchPlayers(match: Match): number[] {
|
||||||
const matchPlayers: number[] = [];
|
const matchPlayers: number[] = [];
|
||||||
matchPlayers.push(this.getPlayerOrSubstitute(match.team1.player1, match.type).id);
|
matchPlayers.push(this.getPlayerOrSubstitute(match.team1.player1, match.type).id);
|
||||||
if (match.team1.player2) matchPlayers.push(this.getPlayerOrSubstitute(match.team1.player2, 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);
|
matchPlayers.push(this.getPlayerOrSubstitute(match.team2.player1, match.type).id);
|
||||||
if (match.team2.player2) matchPlayers.push(this.getPlayerOrSubstitute(match.team2.player2, 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));
|
const counterIds = this.tournament.playersAvailable.filter(player => !matchPlayers.includes(player));
|
||||||
|
|
||||||
return counterIds.map(id => this.getTournamentPlayerFromId(id));
|
return counterIds.map(id => this.getTournamentPlayerFromId(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
getPlayerOrSubstitute(player: Player, type: String): TournamentPlayer {
|
getPlayerOrSubstitute(player: Player, type: String): TournamentPlayer {
|
||||||
return this.getSubstituteForEvent(player, type) || this.getTournamentPlayerFromPlayer(player);
|
return this.getSubstituteForEvent(player, type) || this.getTournamentPlayerFromPlayer(player);
|
||||||
}
|
}
|
||||||
@@ -441,7 +430,7 @@ export class TournamentManageComponent implements OnInit, OnDestroy {
|
|||||||
minHeight: '250px'
|
minHeight: '250px'
|
||||||
}).afterClosed().subscribe(result => {
|
}).afterClosed().subscribe(result => {
|
||||||
if (result != undefined) {
|
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));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@ export class FullNamePipe implements PipeTransform {
|
|||||||
if (person) {
|
if (person) {
|
||||||
return [person.firstName, person.middleName, person.lastName].filter(Boolean).join(" ");
|
return [person.firstName, person.middleName, person.lastName].filter(Boolean).join(" ");
|
||||||
} else {
|
} else {
|
||||||
return "";
|
return "Invalteller";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in new issue
Block a user