added check for ranking
This commit is contained in:
parent
84680362c3
commit
16db253fb4
@ -11,6 +11,7 @@ import { GameService } from '../services/game.service';
|
|||||||
export class ValuesAlignPage {
|
export class ValuesAlignPage {
|
||||||
|
|
||||||
mayContinue: boolean;
|
mayContinue: boolean;
|
||||||
|
nextGame: string;
|
||||||
|
|
||||||
constructor(private router: Router, private game: GameService, public alert: AlertService) {}
|
constructor(private router: Router, private game: GameService, public alert: AlertService) {}
|
||||||
|
|
||||||
@ -46,9 +47,6 @@ export class ValuesAlignPage {
|
|||||||
return;
|
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");
|
this.alert.showLoader("Please wait");
|
||||||
// remove all the cards with value false from array
|
// remove all the cards with value false from array
|
||||||
for(var i = 0; i < this.game.cardset.length; i++){
|
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
|
// set storage and go to the next page
|
||||||
await this.game.saveGameStorage("Values", nextGame, this.game.cardset);
|
|
||||||
this.alert.hideLoader();
|
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}`);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user