From 7cb347c2e3c0f890dc8c8532222e74be9d2ea383 Mon Sep 17 00:00:00 2001 From: Software Magico Date: Wed, 23 Oct 2024 13:25:18 +0200 Subject: [PATCH] Timer can only be opened when a duel is selected. --- .../src/app/views/fight-list/fight-list.component.ts | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/frontend/src/app/views/fight-list/fight-list.component.ts b/frontend/src/app/views/fight-list/fight-list.component.ts index e3c5fe558..ea9785c83 100644 --- a/frontend/src/app/views/fight-list/fight-list.component.ts +++ b/frontend/src/app/views/fight-list/fight-list.component.ts @@ -324,6 +324,8 @@ export class FightListComponent extends RbacBasedComponent implements OnInit, On this.selectedGroup = groups[0]; } + this.selectFirstUnfinishedDuel(); + this.resetFilter(); } @@ -632,8 +634,11 @@ export class FightListComponent extends RbacBasedComponent implements OnInit, On } showTimer(show: boolean): void { - this.timer = show; - this.resetTimerPosition.next(show); + console.log(this.selectedDuel) + if (this.canStartFight(this.selectedDuel)) { + this.timer = show; + this.resetTimerPosition.next(show); + } } setIpponScores(duel: Duel): void { @@ -663,7 +668,7 @@ export class FightListComponent extends RbacBasedComponent implements OnInit, On } canStartFight(duel: Duel | undefined): boolean { - return duel?.competitor1 !== null && duel?.competitor2 !== null; + return duel != undefined && duel?.competitor1 !== null && duel?.competitor2 !== null; } finishDuel(): void {