This commit is contained in:
salam committed 2026-09-23 11:50:01 +02:00
1 parent dc2e6b0fd3
commit 4cdec4be8e
3 files changed
+34 -24

No files matched your search

+24 -18
View File
@@ -17,7 +17,6 @@ class LoadEvents
$team_id = (int) $filter['team_id'] ?? 0; $team_id = (int) $filter['team_id'] ?? 0;
$statistic_type = $filter['statistic_type'] ?? 'gls'; $statistic_type = $filter['statistic_type'] ?? 'gls';
$team_position = $filter['team_position']; $team_position = $filter['team_position'];
$seasonmode = $filter['seasonmode'];
$accuracy = (float) $filter['accuracy'] ?? 0.5; $accuracy = (float) $filter['accuracy'] ?? 0.5;
$similar_past_matches = $filter['similar_past_matches']; $similar_past_matches = $filter['similar_past_matches'];
@@ -44,8 +43,6 @@ class LoadEvents
$match = StatisticFixtures::with('home')->with('away')->where('id', (int) $match_id)->first(); $match = StatisticFixtures::with('home')->with('away')->where('id', (int) $match_id)->first();
// dd($match);
if (! $match) { if (! $match) {
return []; return [];
} }
@@ -98,6 +95,12 @@ class LoadEvents
$expectations = LoadExpectations::load($res['all'], $match, $statistic_type); $expectations = LoadExpectations::load($res['all'], $match, $statistic_type);
// dd($expectations);
$label1 = '';
$label2 = '';
$label3 = '';
$label4 = '';
if ($team_id) { if ($team_id) {
foreach ($res[$team_position] as $value) { foreach ($res[$team_position] as $value) {
@@ -255,22 +258,24 @@ class LoadEvents
break; break;
} }
if ($team_id == $value['home_id']) { if ($team_id) {
$dataset_home[] = (int) $value['val_home']; if ($team_id == $value['home_id']) {
$dataset_away[] = (int) $value['val_away']; $dataset_home[] = (int) $value['val_home'];
} elseif ($team_id == $value['away_id']) { $dataset_away[] = (int) $value['val_away'];
$dataset_home[] = (int) $value['val_away']; } elseif ($team_id == $value['away_id']) {
$dataset_away[] = (int) $value['val_home']; $dataset_home[] = (int) $value['val_away'];
$dataset_away[] = (int) $value['val_home'];
}
} else {
if ($match->home_id == $value['home_id']) {
$dataset_home[] = (int) $value['val_home'];
$dataset_away[] = (int) $value['val_away'];
} else {
$dataset_home[] = (int) $value['val_away'];
$dataset_away[] = (int) $value['val_home'];
}
} }
// Home playing HOME done and commited
// if ($match->home_id == $value['home_id']) {
// $dataset_home[] = (int) $value['val_home'];
// $dataset_away[] = (int) $value['val_away'];
// } else {
// $dataset_home[] = (int) $value['val_away'];
// $dataset_away[] = (int) $value['val_home'];
// }
// Home playing AWAY done and commited // Home playing AWAY done and commited
if ($match->away_id == $value['home_id']) { if ($match->away_id == $value['home_id']) {
$dataset_home2[] = (int) $value['val_home']; $dataset_home2[] = (int) $value['val_home'];
@@ -279,6 +284,7 @@ class LoadEvents
$dataset_home2[] = (int) $value['val_away']; $dataset_home2[] = (int) $value['val_away'];
$dataset_away2[] = (int) $value['val_home']; $dataset_away2[] = (int) $value['val_home'];
} }
} }
$n = max(count($dataset_home), count($dataset_away), count($dataset_away2), count($dataset_home2)); $n = max(count($dataset_home), count($dataset_away), count($dataset_away2), count($dataset_home2));
if ($n) { if ($n) {
@@ -366,7 +372,7 @@ class LoadEvents
]; ];
} }
if (isset($dataset_home2) && isset($dataset_away2)) { if ($label3 && $label4 && isset($dataset_home2) && isset($dataset_away2)) {
$data['datasets'][] = [ $data['datasets'][] = [
'label' => $label3, 'label' => $label3,
'events' => $events, 'events' => $events,
@@ -5,6 +5,7 @@ namespace App\Filament\Widgets\Data\LoadEvents;
use App\Filament\Pages\Selections\Helper\GetSeason; use App\Filament\Pages\Selections\Helper\GetSeason;
use App\Models\StatistikoEvent; use App\Models\StatistikoEvent;
use App\Models\StatistikoPlayer; use App\Models\StatistikoPlayer;
use Illuminate\Support\Facades\Log;
class LoadEventsQuery class LoadEventsQuery
{ {
@@ -33,9 +34,11 @@ class LoadEventsQuery
$statistic_type = 'gls'; $statistic_type = 'gls';
} }
// if($similar_past_matches != 'none'){ if ($similar_past_matches != 'none') {
// $team_id = 0; $team_position = '';
// } $team_id = 0;
$ss_player_id = 0;
}
// dd($season); // dd($season);
$season = GetSeason::load($season, $seasonmode); $season = GetSeason::load($season, $seasonmode);
@@ -134,6 +137,7 @@ class LoadEventsQuery
// dd($res); // dd($res);
// dd($season, $league_id, $res); // dd($season, $league_id, $res);
Log::info('season', $season);
$arr = []; $arr = [];
foreach ($res as $value) { foreach ($res as $value) {
@@ -8,8 +8,6 @@ class LoadExpectations
{ {
public static function load(array $data, object $match, string $statistic_type) public static function load(array $data, object $match, string $statistic_type)
{ {
$home_id = $match->home_id;
$away_id = $match->away_id;
// dd($data, $match); // dd($data, $match);
@@ -64,6 +62,8 @@ class LoadExpectations
$away_got_total = []; $away_got_total = [];
$away_got_away = []; $away_got_away = [];
$home_id = $match->home_id;
$away_id = $match->away_id;
foreach ($data as $value) { foreach ($data as $value) {
// HOME // HOME
// if ($value['home_id'] == $home_id || $value['away_id'] == $home_id) { // if ($value['home_id'] == $home_id || $value['away_id'] == $home_id) {
@@ -121,7 +121,6 @@ class LoadExpectations
$away_got_total[] = $value['val_home']; $away_got_total[] = $value['val_home'];
$away_got_away[] = $value['val_away']; $away_got_away[] = $value['val_away'];
} }
} }
$summe_home = array_sum($home_made_total) * $uba_home_made_total; $summe_home = array_sum($home_made_total) * $uba_home_made_total;
@@ -135,6 +134,7 @@ class LoadExpectations
$count_home = ! $count_home ? 1 : $count_home; $count_home = ! $count_home ? 1 : $count_home;
$aspettativa_home = round($summe_home / $count_home, 1); $aspettativa_home = round($summe_home / $count_home, 1);
// dd($count_home, $summe_home, $aspettativa_home);
$summe_away = array_sum($away_made_total) * $uba_away_made_total; $summe_away = array_sum($away_made_total) * $uba_away_made_total;
$summe_away += array_sum($away_made_away) * $uba_away_made_home; $summe_away += array_sum($away_made_away) * $uba_away_made_home;