Blocca assegnazione punti al raggiungimento della vittoria
Aggiunge controllo che impedisce di assegnare ulteriori punti quando viene raggiunta la condizione di vittoria (25 punti con 2 di vantaggio nei set 1-4, 15 punti con 2 di vantaggio nel set decisivo)
This commit is contained in:
@@ -75,6 +75,12 @@ export default {
|
||||
}
|
||||
},
|
||||
incPunt(team) {
|
||||
// Controlla se c'è già una condizione di vittoria
|
||||
if (this.checkVittoria()) {
|
||||
this.$waveui.notify("Il set è terminato!", "warning");
|
||||
return;
|
||||
}
|
||||
|
||||
this.sp.punt[team]++;
|
||||
if (team == 'home') {
|
||||
this.sp.striscia.home.push(this.sp.punt.home)
|
||||
@@ -82,10 +88,31 @@ export default {
|
||||
} else {
|
||||
this.sp.striscia.guest.push(this.sp.punt.guest)
|
||||
this.sp.striscia.home.push(' ')
|
||||
}
|
||||
}
|
||||
this.sp.servHome = (team == "home");
|
||||
this.sp.form[team].push(this.sp.form[team].shift());
|
||||
},
|
||||
checkVittoria() {
|
||||
const puntHome = this.sp.punt.home;
|
||||
const puntGuest = this.sp.punt.guest;
|
||||
const setHome = this.sp.set.home;
|
||||
const setGuest = this.sp.set.guest;
|
||||
const totSet = setHome + setGuest;
|
||||
|
||||
// Determina se siamo nel set decisivo (5° set)
|
||||
const isSetDecisivo = totSet >= 4;
|
||||
const punteggioVittoria = isSetDecisivo ? 15 : 25;
|
||||
|
||||
// Vittoria con punteggio >= 25 (o 15 per set decisivo) e almeno 2 punti di vantaggio
|
||||
if (puntHome >= punteggioVittoria && puntHome - puntGuest >= 2) {
|
||||
return true; // Home ha vinto
|
||||
}
|
||||
if (puntGuest >= punteggioVittoria && puntGuest - puntHome >= 2) {
|
||||
return true; // Guest ha vinto
|
||||
}
|
||||
|
||||
return false;
|
||||
},
|
||||
decPunt() {
|
||||
if (this.sp.striscia.home.length > 1) {
|
||||
var tmpHome = this.sp.striscia.home.pop()
|
||||
|
||||
Reference in New Issue
Block a user