This commit is contained in:
salam committed 2026-09-17 13:57:30 +02:00
1 parent 766ac81698
commit 097adea62d
1 file changed
+43 -36
+43 -36
View File
@@ -16,6 +16,9 @@ use Filament\Widgets\Widget;
use Illuminate\Support\Facades\Auth; use Illuminate\Support\Facades\Auth;
use Livewire\Attributes\On; use Livewire\Attributes\On;
/**
* --- Aspettativa di Gioco (AdG) = Somma Goals fatti da Player nel DB / Somma Minuti Giocati da Player (SMG) nel DB * 90. 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
*/
class PlayerPropsDrop extends Widget class PlayerPropsDrop extends Widget
{ {
protected string $view = 'livewire.player-props-drop'; protected string $view = 'livewire.player-props-drop';
@@ -367,6 +370,16 @@ class PlayerPropsDrop extends Widget
foreach ($player_totals as $val) { foreach ($player_totals as $val) {
if ($val->details != null && $val->details->position != 'GK' && (int) $val->details->is_active != 0) { if ($val->details != null && $val->details->position != 'GK' && (int) $val->details->is_active != 0) {
/***
"goals" => 0
"fouls" => 13
"cards" => 3
"offsides" => 0
"shots_on_target" => 3
"shots_off_target" => 2
"total_shots" => 4
*/
$ss_player_id = $val->ss_player_id; $ss_player_id = $val->ss_player_id;
$position = $val->details->position; $position = $val->details->position;
@@ -416,64 +429,58 @@ class PlayerPropsDrop extends Widget
switch ($bettype) { switch ($bettype) {
case 'goals': case 'goals':
if ($val->total_min < $this->y_value || $val->goals == 0) { if ($val->goals < $this->y_value) {
$tmp['asp_gioco_'.$bettype] = $asp_statistica; $asp_gioco = $asp_statistica;
$tmp['asp_teorica_'.$bettype] = $asp_statistica;
} else { } else {
$asp_gioco = $val->goals / $val->total_min * 90; $asp_gioco = $val->goals / $val->total_min * 90;
$tmp['asp_gioco_'.$bettype] = $asp_gioco;
$tmp['asp_teorica_'.$bettype] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value);
} }
$tmp['asp_gioco_'.$bettype] = $asp_gioco;
$tmp['asp_teorica_'.$bettype] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value);
break; break;
case 'cards': case 'cards':
if ($val->total_min < $this->y_value || $val->cards == 0) { if ($val->cards < $this->y_value) {
$tmp['asp_gioco_'.$bettype] = $asp_statistica; $asp_gioco = $asp_statistica;
$tmp['asp_teorica_'.$bettype] = $asp_statistica;
} else { } else {
$asp_gioco = $val->cards / $val->total_min * 90; $asp_gioco = $val->cards / $val->total_min * 90;
$tmp['asp_gioco_'.$bettype] = $asp_gioco;
$tmp['asp_teorica_'.$bettype] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value);
} }
$tmp['asp_gioco_'.$bettype] = $asp_gioco;
$tmp['asp_teorica_'.$bettype] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value);
break; break;
case 'fouls': case 'fouls':
if ($val->total_min < $this->y_value || $val->fouls == 0) { if ($val->fouls < $this->y_value) {
$tmp['asp_gioco_'.$bettype] = $asp_statistica; $asp_gioco = $asp_statistica;
$tmp['asp_teorica_'.$bettype] = $asp_statistica;
} else { } else {
$asp_gioco = $val->fouls / $val->total_min * 90; $asp_gioco = $val->fouls / $val->total_min * 90;
$tmp['asp_gioco_'.$bettype] = $asp_gioco;
$tmp['asp_teorica_'.$bettype] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value);
} }
$tmp['asp_gioco_'.$bettype] = $asp_gioco;
$tmp['asp_teorica_'.$bettype] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value);
break; break;
case 'offsides': case 'offsides':
if ($val->total_min < $this->y_value || $val->offsides == 0) { if ($val->offsides < $this->y_value) {
$tmp['asp_gioco_'.$bettype] = $asp_statistica; $asp_gioco = $asp_statistica;
$tmp['asp_teorica_'.$bettype] = $asp_statistica;
} else { } else {
$asp_gioco = $val->offsides / $val->total_min * 90; $asp_gioco = $val->offsides / $val->total_min * 90;
$tmp['asp_gioco_'.$bettype] = $asp_gioco;
$tmp['asp_teorica_'.$bettype] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value);
} }
$tmp['asp_gioco_'.$bettype] = $asp_gioco;
$tmp['asp_teorica_'.$bettype] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value);
break; break;
case 'total_shots': case 'total_shots':
if ($val->total_min < $this->y_value || $val->total_shots == 0) { if ($val->total_shots < $this->y_value) {
$tmp['asp_gioco_'.$bettype] = $asp_statistica; $asp_gioco = $asp_statistica;
$tmp['asp_teorica_'.$bettype] = $asp_statistica;
} else { } else {
$asp_gioco = $val->total_shots / $val->total_min * 90; $asp_gioco = $val->total_shots / $val->total_min * 90;
$tmp['asp_gioco_'.$bettype] = $asp_gioco;
$tmp['asp_teorica_'.$bettype] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value);
} }
$tmp['asp_gioco_'.$bettype] = $asp_gioco;
$tmp['asp_teorica_'.$bettype] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value);
break; break;
case 'shots_on_target': case 'shots_on_target':
if ($val->total_min < $this->y_value || $val->shots_on_target == 0) { if ($val->shots_on_target < $this->y_value) {
$tmp['asp_gioco_'.$bettype] = $asp_statistica; $asp_gioco = $asp_statistica;
$tmp['asp_teorica_'.$bettype] = $asp_statistica;
} else { } else {
$asp_gioco = $val->shots_on_target / $val->total_min * 90; $asp_gioco = $val->shots_on_target / $val->total_min * 90;
$tmp['asp_gioco_'.$bettype] = $asp_gioco;
$tmp['asp_teorica_'.$bettype] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value);
} }
$tmp['asp_gioco_'.$bettype] = $asp_gioco;
$tmp['asp_teorica_'.$bettype] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value);
break; break;
} }
} }
@@ -503,39 +510,39 @@ class PlayerPropsDrop extends Widget
// $results[$key]['asp_player_'.$bettype] = ($asp_team * $asp_team_riferimento) / $total_bettype; // $results[$key]['asp_player_'.$bettype] = ($asp_team * $asp_team_riferimento) / $total_bettype;
$asp_team_riferimento = (float) $asp_team * $count_player / 10; $asp_team_riferimento = (float) $asp_team * $count_player / 10;
$results[$key]['asp_riferimento_goals'] = $asp_team_riferimento;
$results[$key]['asp_total_'.$bettype] = $total_bettype; $results[$key]['asp_total_'.$bettype] = $total_bettype;
$results[$key]['asp_player_'.$bettype] = $value['asp_teorica_'.$bettype] * $asp_team_riferimento / $total_bettype; $results[$key]['asp_player_'.$bettype] = $value['asp_teorica_'.$bettype] * $asp_team_riferimento / $total_bettype;
$results[$key]['asp_riferimento_goals'] = $asp_team_riferimento;
break; break;
case 'cards': case 'cards':
$asp_team_riferimento = (float) $asp_team_all['crd'][$team_home_away] * $count_player / 10; $asp_team_riferimento = (float) $asp_team_all['crd'][$team_home_away] * $count_player / 10;
$results[$key]['asp_team_riferimento_card'] = $asp_team_riferimento;
$results[$key]['asp_player_'.$bettype] = $value['asp_teorica_'.$bettype] * $asp_team_riferimento / $total_bettype; $results[$key]['asp_player_'.$bettype] = $value['asp_teorica_'.$bettype] * $asp_team_riferimento / $total_bettype;
$results[$key]['asp_total_'.$bettype] = $total_bettype; $results[$key]['asp_total_'.$bettype] = $total_bettype;
$results[$key]['asp_team_riferimento_card'] = $asp_team_riferimento;
break; break;
case 'fouls': case 'fouls':
$asp_team_riferimento = (float) $asp_team_all['fls'][$team_home_away] * $count_player / 10; $asp_team_riferimento = (float) $asp_team_all['fls'][$team_home_away] * $count_player / 10;
$results[$key]['asp_team_riferimento_fouls'] = $asp_team_riferimento;
$results[$key]['asp_total_'.$bettype] = $total_bettype; $results[$key]['asp_total_'.$bettype] = $total_bettype;
$results[$key]['asp_player_'.$bettype] = $value['asp_teorica_'.$bettype] * $asp_team_riferimento / $total_bettype; $results[$key]['asp_player_'.$bettype] = $value['asp_teorica_'.$bettype] * $asp_team_riferimento / $total_bettype;
$results[$key]['asp_team_riferimento_fouls'] = $asp_team_riferimento;
break; break;
case 'offsides': case 'offsides':
$asp_team_riferimento = (float) $asp_team_all['ofs'][$team_home_away] * $count_player / 10; $asp_team_riferimento = (float) $asp_team_all['ofs'][$team_home_away] * $count_player / 10;
$results[$key]['asp_team_riferimento_offside'] = $asp_team_riferimento;
$results[$key]['asp_total_'.$bettype] = $total_bettype; $results[$key]['asp_total_'.$bettype] = $total_bettype;
$results[$key]['asp_player_'.$bettype] = $value['asp_teorica_'.$bettype] * $asp_team_riferimento / $total_bettype; $results[$key]['asp_player_'.$bettype] = $value['asp_teorica_'.$bettype] * $asp_team_riferimento / $total_bettype;
$results[$key]['asp_team_riferimento_offside'] = $asp_team_riferimento;
break; break;
case 'total_shots': case 'total_shots':
$asp_team_riferimento = (float) $asp_team_all['tsh'][$team_home_away] * $count_player / 10; $asp_team_riferimento = (float) $asp_team_all['tsh'][$team_home_away] * $count_player / 10;
$results[$key]['asp_team_riferimento_tsh'] = $asp_team_riferimento;
$results[$key]['asp_total_'.$bettype] = $total_bettype; $results[$key]['asp_total_'.$bettype] = $total_bettype;
$results[$key]['asp_player_'.$bettype] = $value['asp_teorica_'.$bettype] * $asp_team_riferimento / $total_bettype; $results[$key]['asp_player_'.$bettype] = $value['asp_teorica_'.$bettype] * $asp_team_riferimento / $total_bettype;
$results[$key]['asp_team_riferimento_tsh'] = $asp_team_riferimento;
break; break;
case 'shots_on_target': case 'shots_on_target':
$asp_team_riferimento = (float) $asp_team_all['snt'][$team_home_away] * $count_player / 10; $asp_team_riferimento = (float) $asp_team_all['snt'][$team_home_away] * $count_player / 10;
$results[$key]['asp_team_riferimento_snt'] = $asp_team_riferimento;
$results[$key]['asp_total_'.$bettype] = $total_bettype; $results[$key]['asp_total_'.$bettype] = $total_bettype;
$results[$key]['asp_player_'.$bettype] = $value['asp_teorica_'.$bettype] * $asp_team_riferimento / $total_bettype; $results[$key]['asp_player_'.$bettype] = $value['asp_teorica_'.$bettype] * $asp_team_riferimento / $total_bettype;
$results[$key]['asp_team_riferimento_snt'] = $asp_team_riferimento;
break; break;
} }
} }