From d793f0b844df2280e93bb769362ed64e0350d578 Mon Sep 17 00:00:00 2001 From: salam Date: Sat, 12 Sep 2026 12:00:40 +0200 Subject: [PATCH] wip --- app/Livewire/BoardDispatcher.php | 42 +++++++++++++++++++++++--------- 1 file changed, 31 insertions(+), 11 deletions(-) diff --git a/app/Livewire/BoardDispatcher.php b/app/Livewire/BoardDispatcher.php index 5933e5a4..0426a9da 100644 --- a/app/Livewire/BoardDispatcher.php +++ b/app/Livewire/BoardDispatcher.php @@ -554,18 +554,9 @@ class BoardDispatcher extends Component implements HasActions, HasSchemas, HasTa // Se la SMG è < Y per quel Player prenderemo in considerazione solo l'Aspettativa Statistica (AS). // Il valore Y dovrebbe essere configurabile in una interfaccia. Il valore iniziale lo fissiamo a Y = 180 - // Somma Goals fatti da Player nel DB - $somma_goals = $val->goals; - $tmp['somma_goals'] = $somma_goals; - // Somma Minuti Giocati da Player (SMG) nel DB $somma_minuti = $val->total_min; - $tmp['somma_minuti'] = $somma_minuti; - - // Aspettativa di Gioco - // (AdG) - $asp_gioco = $somma_goals / $somma_minuti * 90; - $tmp['asp_gioco'] = $asp_gioco; + $tmp['somma_minuti'] = $val->total_min; // il valore corrispondente al ruolo del Player (esempio un giocatore in Details ha ruolo = RW // quindi Aspettativa Statistica (AS) per RW = 0.219) @@ -593,9 +584,38 @@ class BoardDispatcher extends Component implements HasActions, HasSchemas, HasTa // dove X è un valore che dovrebbe essere parametrizzabile da una interfaccia. // Il valore iniziale lo fissiamo a X = 3 // (AT) - $tmp['asp_teorica_'.$bettype] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value); + switch ($bettype) { + case 'goals': + // Aspettativa di Gioco + // (AdG) + $asp_gioco = $val->goals / $somma_minuti * 90; + $tmp['asp_teorica_goals'] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value); + break; + case 'cards': + $asp_gioco = $val->cards / $somma_minuti * 90; + $tmp['asp_teorica_cards'] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value); + break; + case 'fouls': + $asp_gioco = $val->fouls / $somma_minuti * 90; + $tmp['asp_teorica_fouls'] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value); + break; + case 'offsides': + $asp_gioco = $val->offsides / $somma_minuti * 90; + $tmp['asp_teorica_offsides'] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value); + break; + case 'total_shots': + $asp_gioco = $val->total_shots / $somma_minuti * 90; + $tmp['asp_teorica_total_shots'] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value); + break; + case 'shots_on_target': + $asp_gioco = $val->shots_on_target / $somma_minuti * 90; + $tmp['asp_teorica_shots_on_target'] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value); + break; + + } } } + // Calcolare la Somma di tutte le AT (colonna G della Tabella) // Considerare la ATR calcolata allo Step 1 (colonna I della Tabella) // Aspettativa per Player: AP = AT * ATR / TOT AT