From 16db253fb443afd55668554a93be4eba7bb8577a Mon Sep 17 00:00:00 2001 From: spekulaas Date: Fri, 4 Feb 2022 15:55:29 +0100 Subject: [PATCH] added check for ranking --- .../src/app/valuesAlign/valuesAlign.page.ts | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/AuthentesApp/src/app/valuesAlign/valuesAlign.page.ts b/AuthentesApp/src/app/valuesAlign/valuesAlign.page.ts index 2593842..7a458aa 100644 --- a/AuthentesApp/src/app/valuesAlign/valuesAlign.page.ts +++ b/AuthentesApp/src/app/valuesAlign/valuesAlign.page.ts @@ -11,6 +11,7 @@ import { GameService } from '../services/game.service'; export class ValuesAlignPage { mayContinue: boolean; + nextGame: string; constructor(private router: Router, private game: GameService, public alert: AlertService) {} @@ -46,9 +47,6 @@ export class ValuesAlignPage { return; } - let addvalues = await this.alert.presentAlertConfirm("Missing values?", "Do you want to add values to the list?", "yes", "no"); - let nextGame = addvalues == "yes" ? "Add" : "Ranking"; - this.alert.showLoader("Please wait"); // remove all the cards with value false from array for(var i = 0; i < this.game.cardset.length; i++){ @@ -60,8 +58,17 @@ export class ValuesAlignPage { } // set storage and go to the next page - await this.game.saveGameStorage("Values", nextGame, this.game.cardset); this.alert.hideLoader(); - this.router.navigateByUrl(`/values${nextGame}`); + + if(this.game.cardset.length < 5){ + let addvalues = await this.alert.presentAlertConfirm("Missing values?", "Do you want to add values to the list?", "yes", "no"); + this.nextGame = addvalues == "yes" ? "Add" : "Ranking"; + }else{ + this.nextGame = "Ranking"; + } + + await this.game.saveGameStorage("Values", this.nextGame, this.game.cardset); + + this.router.navigateByUrl(`/values${this.nextGame}`); } }