fix : added auto clear to multi leg pool also
This commit is contained in:
parent
9451abf500
commit
494e40d17d
@ -616,19 +616,14 @@ if (this.twoGroupLabels.includes(this.selectedLabel || '')) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------ENTER PAD VALUE-------------------------------------
|
//-----------------------------ENTER PAD VALUE-------------------------------------
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
enterPadVal(key: string) {
|
enterPadVal(key: string) {
|
||||||
if (!this.numericPadEnabled || this.totalAmountLimitReached) return;
|
if (!this.numericPadEnabled || this.totalAmountLimitReached) return;
|
||||||
|
|
||||||
if (key === 'X') {
|
if (key === 'X') {
|
||||||
this.padValue = '';
|
this.padValue = '';
|
||||||
if (this.selectedLabel === 'WSP') {
|
if (this.selectedLabel === 'WSP') {
|
||||||
this.wspTicketStage = 0; // Reset stage if WSP
|
this.wspTicketStage = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Clear the current row to reset any invalid state
|
|
||||||
this.selectionService.updatePartial({
|
this.selectionService.updatePartial({
|
||||||
label: this.selectedLabel || '',
|
label: this.selectedLabel || '',
|
||||||
numbers: [...this.selectedNumbers],
|
numbers: [...this.selectedNumbers],
|
||||||
@ -668,7 +663,6 @@ if (this.twoGroupLabels.includes(this.selectedLabel || '')) {
|
|||||||
|
|
||||||
this.selectionService.setSelections(updatedSelections);
|
this.selectionService.setSelections(updatedSelections);
|
||||||
|
|
||||||
// Check if total is 0 for WSP (indicating invalid row)
|
|
||||||
const currentTotal = updatedSelections.find(sel => sel.label === targetLabel)?.total || 0;
|
const currentTotal = updatedSelections.find(sel => sel.label === targetLabel)?.total || 0;
|
||||||
if (currentTotal === 0 && value > 0) {
|
if (currentTotal === 0 && value > 0) {
|
||||||
console.log('[DEBUG] WSP row invalid (total = 0), clearing row');
|
console.log('[DEBUG] WSP row invalid (total = 0), clearing row');
|
||||||
@ -689,7 +683,71 @@ if (this.twoGroupLabels.includes(this.selectedLabel || '')) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Default path for non-WSP
|
if (this.multiLegLabels.includes(this.selectedLabel || '')) {
|
||||||
|
const maxLegs = this.getMaxLegs(this.currentPool || '');
|
||||||
|
const legsFilled = this.multiLegGroups.slice(0, maxLegs).every(group => group.length > 0);
|
||||||
|
|
||||||
|
if (!legsFilled) {
|
||||||
|
console.log('[DEBUG] Multi-leg pool incomplete (not all legs filled), clearing row');
|
||||||
|
this.selectionService.updatePartial({
|
||||||
|
label: '',
|
||||||
|
numbers: [],
|
||||||
|
value: 0,
|
||||||
|
total: 0,
|
||||||
|
isBoxed: false
|
||||||
|
});
|
||||||
|
this.selectedLabel = null;
|
||||||
|
this.selectedNumbers = [];
|
||||||
|
this.padValue = '';
|
||||||
|
this.isBoxed = false;
|
||||||
|
this.multiLegStage = 0;
|
||||||
|
this.multiLegGroups = [[], [], [], [], []];
|
||||||
|
this.currentPool = null;
|
||||||
|
this.multiLegBaseRaceIdx = 0;
|
||||||
|
this.currentLegRaceDisplay = '';
|
||||||
|
this.sharedStateService.updateSharedData({
|
||||||
|
type: 'multiLegPoolEnd',
|
||||||
|
value: null
|
||||||
|
});
|
||||||
|
this.updateCanPrint();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
this.selectionService.updatePartial({
|
||||||
|
value,
|
||||||
|
isBoxed: this.isBoxed,
|
||||||
|
label: this.selectedLabel || '',
|
||||||
|
numbers: [...this.selectedNumbers]
|
||||||
|
});
|
||||||
|
|
||||||
|
const currentRow = this.selectionService.getCurrentRow();
|
||||||
|
if (currentRow.total === 0 && value > 0 && currentRow.numbers.length > 0) {
|
||||||
|
console.log('[DEBUG] Multi-leg row invalid (total = 0), auto-clearing current row');
|
||||||
|
this.selectionService.updatePartial({
|
||||||
|
label: '',
|
||||||
|
numbers: [],
|
||||||
|
value: 0,
|
||||||
|
total: 0,
|
||||||
|
isBoxed: false
|
||||||
|
});
|
||||||
|
this.selectedLabel = null;
|
||||||
|
this.selectedNumbers = [];
|
||||||
|
this.padValue = '';
|
||||||
|
this.isBoxed = false;
|
||||||
|
this.multiLegStage = 0;
|
||||||
|
this.multiLegGroups = [[], [], [], [], []];
|
||||||
|
this.currentPool = null;
|
||||||
|
this.multiLegBaseRaceIdx = 0;
|
||||||
|
this.currentLegRaceDisplay = '';
|
||||||
|
this.sharedStateService.updateSharedData({
|
||||||
|
type: 'multiLegPoolEnd',
|
||||||
|
value: null
|
||||||
|
});
|
||||||
|
this.updateCanPrint();
|
||||||
|
}
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this.selectionService.updatePartial({
|
this.selectionService.updatePartial({
|
||||||
value,
|
value,
|
||||||
isBoxed: this.isBoxed,
|
isBoxed: this.isBoxed,
|
||||||
@ -697,7 +755,6 @@ if (this.twoGroupLabels.includes(this.selectedLabel || '')) {
|
|||||||
numbers: [...this.selectedNumbers]
|
numbers: [...this.selectedNumbers]
|
||||||
});
|
});
|
||||||
|
|
||||||
// Check if total is 0 after updating (indicating invalid mathematical logic)
|
|
||||||
const currentRow = this.selectionService.getCurrentRow();
|
const currentRow = this.selectionService.getCurrentRow();
|
||||||
if (currentRow.total === 0 && value > 0 && currentRow.numbers.length > 0) {
|
if (currentRow.total === 0 && value > 0 && currentRow.numbers.length > 0) {
|
||||||
console.log('[DEBUG] Row invalid (total = 0), auto-clearing current row');
|
console.log('[DEBUG] Row invalid (total = 0), auto-clearing current row');
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user