diff --git a/app/Filament/Widgets/PlayerPropsDrop.php b/app/Filament/Widgets/PlayerPropsDrop.php index 1dffa308..88df3225 100644 --- a/app/Filament/Widgets/PlayerPropsDrop.php +++ b/app/Filament/Widgets/PlayerPropsDrop.php @@ -430,7 +430,7 @@ class PlayerPropsDrop extends Widget switch ($bettype) { case 'goals': if ($val->goals < $this->y_value) { - $asp_gioco = $asp_statistica; + $asp_gioco = 0; } else { $asp_gioco = $val->goals / $val->total_min * 90; } @@ -439,7 +439,7 @@ class PlayerPropsDrop extends Widget break; case 'cards': if ($val->cards < $this->y_value) { - $asp_gioco = $asp_statistica; + $asp_gioco = 0; } else { $asp_gioco = $val->cards / $val->total_min * 90; } @@ -448,7 +448,7 @@ class PlayerPropsDrop extends Widget break; case 'fouls': if ($val->fouls < $this->y_value) { - $asp_gioco = $asp_statistica; + $asp_gioco = 0; } else { $asp_gioco = $val->fouls / $val->total_min * 90; } @@ -457,7 +457,7 @@ class PlayerPropsDrop extends Widget break; case 'offsides': if ($val->offsides < $this->y_value) { - $asp_gioco = $asp_statistica; + $asp_gioco = 0; } else { $asp_gioco = $val->offsides / $val->total_min * 90; } @@ -466,7 +466,7 @@ class PlayerPropsDrop extends Widget break; case 'total_shots': if ($val->total_shots < $this->y_value) { - $asp_gioco = $asp_statistica; + $asp_gioco = 0; } else { $asp_gioco = $val->total_shots / $val->total_min * 90; } @@ -475,7 +475,7 @@ class PlayerPropsDrop extends Widget break; case 'shots_on_target': if ($val->shots_on_target < $this->y_value) { - $asp_gioco = $asp_statistica; + $asp_gioco = 0; } else { $asp_gioco = $val->shots_on_target / $val->total_min * 90; } @@ -500,6 +500,7 @@ class PlayerPropsDrop extends Widget $bettypes = ['goals', 'cards', 'fouls', 'offsides', 'total_shots', 'shots_on_target']; foreach ($bettypes as $bettype) { + $total_bettype = array_sum(array_column($results, 'asp_teorica_'.$bettype)); foreach ($results as $key => $value) { @@ -550,9 +551,9 @@ class PlayerPropsDrop extends Widget $this->calculationVariables = $results; - foreach ($this->players as $k => $record) { + foreach ($this->players as $k => $player) { foreach ($results as $key => $result) { - if ((int) $record['id'] == (int) $result['id']) { + if ((int) $player['id'] == (int) $result['id']) { $this->players[$k]['active'] = $result['active']; $this->players[$k]['gls'] = number_format($result['asp_player_goals'], 3); $this->players[$k]['fls'] = number_format($result['asp_player_fouls'], 3);