Expectations finale

This commit is contained in:
salam committed 2026-09-17 20:03:06 +02:00
1 parent 2c641b5507
commit bbd6251020
3 files changed
+267 -74

No files matched your search

+29 -19
View File
@@ -86,22 +86,32 @@ class PlayerPropsDrop extends Widget
#[On('match-update')]
public function matchUpdate(?int $match_id)
{
$this->clearResultTable();
$this->team_name = '';
$this->match_id = 0;
$this->players = [];
for ($i = 1; $i <= 35; $i++) {
$this->boxes[$i] = [];
}
if ($match_id) {
$this->match_id = $match_id;
} else {
$this->team_name = '';
}
$this->dispatch('update-players', players: $this->players);
}
#[On('team-update')]
public function syncData(int $team_id)
public function syncData(?int $team_id)
{
$this->players = PlayerCalculator::load($team_id);
$this->team_name = SofaScoreRosa::where('ss_team_id', $team_id)->value('ss_team_name');
$this->team_id = $team_id;
$this->loadPlacement();
if ($team_id) {
$this->players = PlayerCalculator::load($team_id);
$this->team_name = SofaScoreRosa::where('ss_team_id', $team_id)->value('ss_team_name');
$this->team_id = $team_id;
$this->loadPlacement();
} else {
$this->team_name = '';
$this->clearResultTable();
$this->players = [];
}
}
#[On('lineup-update')]
@@ -365,14 +375,14 @@ class PlayerPropsDrop extends Widget
// (il valore che appare quando viene selezionato un Evento): nell' esempio,
// se scegliamo come Team il Remo (Home) il valore di riferimento sarà 1.2
$team_id = $this->team_id;
$res = StatisticFixtures::where('id', $this->match_id)->first();
$match = StatisticFixtures::where('id', $this->match_id)->first();
$asp_team = 0;
$team_home_away = 'home';
if ((int) $res->home_id == (int) $team_id) {
$asp_team = (float) $res->exp_home;
if ((int) $match->home_id == (int) $team_id) {
$asp_team = (float) $match->exp_home;
$team_home_away = 'home';
} elseif ((int) $res->away_id == (int) $team_id) {
$asp_team = (float) $res->exp_away;
} elseif ((int) $match->away_id == (int) $team_id) {
$asp_team = (float) $match->exp_away;
$team_home_away = 'away';
}
@@ -512,7 +522,7 @@ class PlayerPropsDrop extends Widget
}
}
$asp_team_all = Expectations::load($team_id, $count_player);
$asp_team_all = Expectations::load($match);
// Aspettativa Team di Riferimento
// (ATR) = Aspettativa Team * Numero di Giocatori di Team in Rosters (esclusi i portieri) / 10.
@@ -536,31 +546,31 @@ class PlayerPropsDrop extends Widget
$results[$key]['asp_player_'.$bettype] = $value['asp_teorica_'.$bettype] * $asp_team_riferimento / $total_bettype;
break;
case 'cards':
$asp_team_riferimento = (float) $asp_team_all['crd'][$team_home_away] * $count_player / 10;
$asp_team_riferimento = (float) $asp_team_all[$team_home_away]['crd'] * $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_total_'.$bettype] = $total_bettype;
break;
case 'fouls':
$asp_team_riferimento = (float) $asp_team_all['fls'][$team_home_away] * $count_player / 10;
$asp_team_riferimento = (float) $asp_team_all[$team_home_away]['fls'] * $count_player / 10;
$results[$key]['asp_team_riferimento_fouls'] = $asp_team_riferimento;
$results[$key]['asp_total_'.$bettype] = $total_bettype;
$results[$key]['asp_player_'.$bettype] = $value['asp_teorica_'.$bettype] * $asp_team_riferimento / $total_bettype;
break;
case 'offsides':
$asp_team_riferimento = (float) $asp_team_all['ofs'][$team_home_away] * $count_player / 10;
$asp_team_riferimento = (float) $asp_team_all[$team_home_away]['ofs'] * $count_player / 10;
$results[$key]['asp_team_riferimento_offside'] = $asp_team_riferimento;
$results[$key]['asp_total_'.$bettype] = $total_bettype;
$results[$key]['asp_player_'.$bettype] = $value['asp_teorica_'.$bettype] * $asp_team_riferimento / $total_bettype;
break;
case 'total_shots':
$asp_team_riferimento = (float) $asp_team_all['tsh'][$team_home_away] * $count_player / 10;
$asp_team_riferimento = (float) $asp_team_all[$team_home_away]['tsh'] * $count_player / 10;
$results[$key]['asp_team_riferimento_tsh'] = $asp_team_riferimento;
$results[$key]['asp_total_'.$bettype] = $total_bettype;
$results[$key]['asp_player_'.$bettype] = $value['asp_teorica_'.$bettype] * $asp_team_riferimento / $total_bettype;
break;
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[$team_home_away]['snt'] * $count_player / 10;
$results[$key]['asp_team_riferimento_snt'] = $asp_team_riferimento;
$results[$key]['asp_total_'.$bettype] = $total_bettype;
$results[$key]['asp_player_'.$bettype] = $value['asp_teorica_'.$bettype] * $asp_team_riferimento / $total_bettype;