This commit is contained in:
salam committed 2026-09-14 19:16:51 +02:00
1 parent 093d8b4740
commit 3a430e1a73
2 files changed
+68 -51

No files matched your search

+55 -38
View File
@@ -20,17 +20,29 @@ class PlayerPropsDrop extends Widget
protected string $view = 'livewire.player-props-drop'; protected string $view = 'livewire.player-props-drop';
public float $x_value = 3; public float $x_value = 3;
public float $y_value = 180; public float $y_value = 180;
public array $activeBoxes; public array $activeBoxes;
public array $beschriftung; public array $beschriftung;
public array $lineup; public array $lineup;
public array $lineUpMap; public array $lineUpMap;
public string $activeLineUp; public string $activeLineUp;
public array $boxes; public array $boxes;
public string $team_name = ''; public string $team_name = '';
public int $team_id = 0; public int $team_id = 0;
public int $match_id; public int $match_id;
public int $player_on_field_counter; public int $player_on_field_counter;
public array $calculationVariables; public array $calculationVariables;
public array $players; public array $players;
@@ -241,6 +253,7 @@ class PlayerPropsDrop extends Widget
Notification::make()->title('Needs a calculation first ') Notification::make()->title('Needs a calculation first ')
->info() ->info()
->send(); ->send();
return; return;
} }
@@ -248,9 +261,9 @@ class PlayerPropsDrop extends Widget
foreach ($this->calculationVariables as $row) { foreach ($this->calculationVariables as $row) {
if ($copystring == '') { if ($copystring == '') {
$keys = array_keys($row); $keys = array_keys($row);
$copystring .= implode(';', $keys) . "\n"; $copystring .= implode(';', $keys)."\n";
} }
$copystring .= implode(';', $row) . "\n"; $copystring .= implode(';', $row)."\n";
} }
$this->js("navigator.clipboard.writeText(`$copystring`)"); $this->js("navigator.clipboard.writeText(`$copystring`)");
@@ -266,10 +279,11 @@ class PlayerPropsDrop extends Widget
Notification::make()->title('Needs a calculation first ') Notification::make()->title('Needs a calculation first ')
->info() ->info()
->send(); ->send();
return; return;
} }
$header = ['name', 'foot', 'events', 'average min', 'position', 'on field', 'gls', 'fls', 'ofs', 'snt', 'tsh', 'crd']; $header = ['name', 'foot', 'events', 'average min', 'position', 'on field', 'gls', 'fls', 'ofs', 'snt', 'tsh', 'crd'];
$copystring = implode(';', $header) . "\n"; $copystring = implode(';', $header)."\n";
foreach ($this->players as $row) { foreach ($this->players as $row) {
$tmp = []; $tmp = [];
$tmp[] = $row['name']; $tmp[] = $row['name'];
@@ -289,7 +303,7 @@ class PlayerPropsDrop extends Widget
$tmp[] = $row['tsh']; $tmp[] = $row['tsh'];
$tmp[] = $row['crd']; $tmp[] = $row['crd'];
$copystring .= implode(';', $tmp) . "\n"; $copystring .= implode(';', $tmp)."\n";
} }
$this->js("navigator.clipboard.writeText(`$copystring`)"); $this->js("navigator.clipboard.writeText(`$copystring`)");
@@ -333,14 +347,18 @@ class PlayerPropsDrop extends Widget
$player = StatistikoDetail::where('ss_team_id', (int) $team_id)->where('is_active', 1)->get(); $player = StatistikoDetail::where('ss_team_id', (int) $team_id)->where('is_active', 1)->get();
// dd($player); $count_player = 0;
foreach ($$player as $key => $value) {
if ($value['position'] != 'GK') {
$count_player++;
}
}
// Aspettativa Team di Riferimento // Aspettativa Team di Riferimento
// (ATR) = Aspettativa Team * Numero di Giocatori di Team in Rosters (esclusi i portieri) / 10. // (ATR) = Aspettativa Team * Numero di Giocatori di Team in Rosters (esclusi i portieri) / 10.
// Ad esempio per Remo (supponiamo 24 giocatori nel Roster esclusi i portieri): ATR = 1.2 * 24 / 10 = 2.88 // Ad esempio per Remo (supponiamo 24 giocatori nel Roster esclusi i portieri): ATR = 1.2 * 24 / 10 = 2.88
$asp_team_riferimento = (float) $asp_team * $count_player / 10;
$asp_team_riferimento = (float) $asp_team * $player->count() / 10;
// dd($player->count(), $asp_team_riferimento); // dd($player->count(), $asp_team_riferimento);
@@ -379,6 +397,7 @@ class PlayerPropsDrop extends Widget
$tmp['asp_team'] = $asp_team; $tmp['asp_team'] = $asp_team;
$tmp['asp_team_riferimento'] = $asp_team_riferimento; $tmp['asp_team_riferimento'] = $asp_team_riferimento;
$tmp['team_without_gk'] = $count_player;
$position_field = $this->get_position($ss_player_id); $position_field = $this->get_position($ss_player_id);
if ($position_field) { if ($position_field) {
@@ -410,68 +429,68 @@ class PlayerPropsDrop extends Widget
$bettypes = ['goals', 'cards', 'fouls', 'offsides', 'total_shots', 'shots_on_target']; $bettypes = ['goals', 'cards', 'fouls', 'offsides', 'total_shots', 'shots_on_target'];
foreach ($bettypes as $bettype) { foreach ($bettypes as $bettype) {
$asp_statistica = (float) SofaScorePlayerPosition::where('ss_code', $position)->value('exp_' . $bettype); $asp_statistica = (float) SofaScorePlayerPosition::where('ss_code', $position)->value('exp_'.$bettype);
$tmp['asp_statistica_' . $bettype] = $asp_statistica; $tmp['asp_statistica_'.$bettype] = $asp_statistica;
switch ($bettype) { switch ($bettype) {
case 'goals': case 'goals':
if ($val->total_min < $this->y_value || $val->goals == 0) { if ($val->total_min < $this->y_value || $val->goals == 0) {
$tmp['asp_gioco_' . $bettype] = $asp_statistica; $tmp['asp_gioco_'.$bettype] = $asp_statistica;
$tmp['asp_teorica_' . $bettype] = $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_gioco_'.$bettype] = $asp_gioco;
$tmp['asp_teorica_' . $bettype] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value); $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->total_min < $this->y_value || $val->cards == 0) {
$tmp['asp_gioco_' . $bettype] = $asp_statistica; $tmp['asp_gioco_'.$bettype] = $asp_statistica;
$tmp['asp_teorica_' . $bettype] = $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_gioco_'.$bettype] = $asp_gioco;
$tmp['asp_teorica_' . $bettype] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value); $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->total_min < $this->y_value || $val->fouls == 0) {
$tmp['asp_gioco_' . $bettype] = $asp_statistica; $tmp['asp_gioco_'.$bettype] = $asp_statistica;
$tmp['asp_teorica_' . $bettype] = $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_gioco_'.$bettype] = $asp_gioco;
$tmp['asp_teorica_' . $bettype] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value); $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->total_min < $this->y_value || $val->offsides == 0) {
$tmp['asp_gioco_' . $bettype] = $asp_statistica; $tmp['asp_gioco_'.$bettype] = $asp_statistica;
$tmp['asp_teorica_' . $bettype] = $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_gioco_'.$bettype] = $asp_gioco;
$tmp['asp_teorica_' . $bettype] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value); $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_min < $this->y_value || $val->total_shots == 0) {
$tmp['asp_gioco_' . $bettype] = $asp_statistica; $tmp['asp_gioco_'.$bettype] = $asp_statistica;
$tmp['asp_teorica_' . $bettype] = $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_gioco_'.$bettype] = $asp_gioco;
$tmp['asp_teorica_' . $bettype] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value); $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->total_min < $this->y_value || $val->shots_on_target == 0) {
$tmp['asp_gioco_' . $bettype] = $asp_statistica; $tmp['asp_gioco_'.$bettype] = $asp_statistica;
$tmp['asp_teorica_' . $bettype] = $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_gioco_'.$bettype] = $asp_gioco;
$tmp['asp_teorica_' . $bettype] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value); $tmp['asp_teorica_'.$bettype] = ($this->x_value * $asp_gioco + $asp_statistica) / (1 + $this->x_value);
} }
break; break;
} }
@@ -482,7 +501,6 @@ class PlayerPropsDrop extends Widget
// Aspettativa per Player: AP = AT * ATR / TOT AT // Aspettativa per Player: AP = AT * ATR / TOT AT
$results[] = $tmp; $results[] = $tmp;
// for dev copy // for dev copy
$this->calculationVariables[] = $tmp; $this->calculationVariables[] = $tmp;
} }
@@ -490,15 +508,14 @@ class PlayerPropsDrop extends Widget
Log::debug('results', $results); Log::debug('results', $results);
$bettypes = ['goals', 'cards', 'fouls', 'offsides', 'total_shots', 'shots_on_target']; $bettypes = ['goals', 'cards', 'fouls', 'offsides', 'total_shots', 'shots_on_target'];
foreach ($bettypes as $bettype) { foreach ($bettypes as $bettype) {
$total_bettype = array_sum(array_column($results, 'asp_teorica_' . $bettype)); $total_bettype = array_sum(array_column($results, 'asp_teorica_'.$bettype));
foreach ($results as $key => $value) { foreach ($results as $key => $value) {
// Aspettativa per Player: AP = AT * ATR / TOT AT // Aspettativa per Player: AP = AT * ATR / TOT AT
$results[$key]['asp_total_' . $bettype] = $total_bettype; $results[$key]['asp_total_'.$bettype] = $total_bettype;
// $results[$key]['asp_player_'.$bettype] = ((float) $value['asp_team'] * (float) $value['asp_teorica_'.$bettype]) / $total_bettype; // $results[$key]['asp_player_'.$bettype] = ((float) $value['asp_team'] * (float) $value['asp_teorica_'.$bettype]) / $total_bettype;
$results[$key]['asp_player_' . $bettype] = ($asp_team * $asp_team_riferimento) / $total_bettype; $results[$key]['asp_player_'.$bettype] = ($asp_team * $asp_team_riferimento) / $total_bettype;
} }
} }
Generated
+13 -13
View File
@@ -5269,16 +5269,16 @@
}, },
{ {
"name": "nikic/php-parser", "name": "nikic/php-parser",
"version": "v5.8.0", "version": "v5.9.0",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/nikic/PHP-Parser.git", "url": "https://github.com/nikic/PHP-Parser.git",
"reference": "044a6a392ff8ad0d61f14370a5fbbd0a0107152f" "reference": "9e33da9553fe7786f0962b35f4e4ecf01be89def"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/044a6a392ff8ad0d61f14370a5fbbd0a0107152f", "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/9e33da9553fe7786f0962b35f4e4ecf01be89def",
"reference": "044a6a392ff8ad0d61f14370a5fbbd0a0107152f", "reference": "9e33da9553fe7786f0962b35f4e4ecf01be89def",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
@@ -5320,9 +5320,9 @@
], ],
"support": { "support": {
"issues": "https://github.com/nikic/PHP-Parser/issues", "issues": "https://github.com/nikic/PHP-Parser/issues",
"source": "https://github.com/nikic/PHP-Parser/tree/v5.8.0" "source": "https://github.com/nikic/PHP-Parser/tree/v5.9.0"
}, },
"time": "2026-07-04T14:30:18+00:00" "time": "2026-09-13T18:51:52+00:00"
}, },
{ {
"name": "nunomaduro/termwind", "name": "nunomaduro/termwind",
@@ -12685,21 +12685,21 @@
}, },
{ {
"name": "rector/rector", "name": "rector/rector",
"version": "2.6.6", "version": "2.6.7",
"source": { "source": {
"type": "git", "type": "git",
"url": "https://github.com/rectorphp/rector.git", "url": "https://github.com/rectorphp/rector.git",
"reference": "ca069d6c79feaa6651b423c15d101a27a436093e" "reference": "f4aa224edb9b0630fb43826d4cb6a49b62e48d4c"
}, },
"dist": { "dist": {
"type": "zip", "type": "zip",
"url": "https://api.github.com/repos/rectorphp/rector/zipball/ca069d6c79feaa6651b423c15d101a27a436093e", "url": "https://api.github.com/repos/rectorphp/rector/zipball/f4aa224edb9b0630fb43826d4cb6a49b62e48d4c",
"reference": "ca069d6c79feaa6651b423c15d101a27a436093e", "reference": "f4aa224edb9b0630fb43826d4cb6a49b62e48d4c",
"shasum": "" "shasum": ""
}, },
"require": { "require": {
"php": "^7.4|^8.0", "php": "^7.4|^8.0",
"phpstan/phpstan": "^2.2.10" "phpstan/phpstan": "^2.2.14"
}, },
"conflict": { "conflict": {
"rector/rector-doctrine": "*", "rector/rector-doctrine": "*",
@@ -12730,7 +12730,7 @@
], ],
"support": { "support": {
"issues": "https://github.com/rectorphp/rector/issues", "issues": "https://github.com/rectorphp/rector/issues",
"source": "https://github.com/rectorphp/rector/tree/2.6.6" "source": "https://github.com/rectorphp/rector/tree/2.6.7"
}, },
"funding": [ "funding": [
{ {
@@ -12738,7 +12738,7 @@
"type": "github" "type": "github"
} }
], ],
"time": "2026-09-02T09:38:46+00:00" "time": "2026-09-13T20:17:44+00:00"
}, },
{ {
"name": "sebastian/cli-parser", "name": "sebastian/cli-parser",