Adding "game summary" page to add game component
All checks were successful
Jenkins Production Deployment

This commit is contained in:
Patrick Müller 2022-09-16 13:59:22 +02:00
parent 139fb20814
commit e26cd21cc6
Signed by: Paddy
GPG Key ID: 37ABC11275CAABCE
2 changed files with 31 additions and 1 deletions

View File

@ -54,7 +54,16 @@
</div> </div>
<div id="extra-points" class="visible-{{this.currentPage === 5}}"> <div id="extra-points" class="visible-{{this.currentPage === 5}}">
<p>Extra Points</p> <p>Extra Points</p>
<button (click)="switchToNextPage()">Next</button> <div *ngFor="let player of actualPlayers">
<p>{{player.firstName}}</p>
<input type="number" [(ngModel)]="player.foxesCaught" (change)="this.calculateCurrentScores()"/>
</div>
<p id="foxes-warn" *ngIf="!checkTotalFoxPoints()">Please check the number of caught foxes!</p>
<button (click)="switchToNextPage()" [disabled]="!checkAllExtraPoints()">Next</button>
</div>
<div id="summary" class="visible-{{this.currentPage === 5}}">
<p>Game Summary</p>
<button>Save Game</button>
</div> </div>
</div> </div>
<div id="scores"> <div id="scores">

View File

@ -663,6 +663,9 @@ export class AddGameComponent implements OnInit {
this.soloPlayed = solo; this.soloPlayed = solo;
} }
/**
* Returns true if there is a solo selected, false otherwise
*/
noSoloSelectedYet(): boolean { noSoloSelectedYet(): boolean {
return this.soloPlayed === undefined; return this.soloPlayed === undefined;
} }
@ -675,5 +678,23 @@ export class AddGameComponent implements OnInit {
* /_____/_/|_|\__/_/ \__,_/ /_/ \____/_/_/ /_/\__/____/ * /_____/_/|_|\__/_/ \__,_/ /_/ \____/_/_/ /_/\__/____/
*/ */
/**
* Checks if the number of caught foxes checks out
*/
checkTotalFoxPoints(): boolean {
let totalFoxPoints: number = 0;
for (let player of this.actualPlayers) {
totalFoxPoints += player.foxesCaught ?? 0;
}
return totalFoxPoints <= 2;
}
/**
* Checks if all extra point types have valid entries
*/
checkAllExtraPoints(): boolean {
return this.checkTotalFoxPoints();
}
} }