This commit is contained in:
salam committed 2026-08-24 19:13:37 +02:00
1 parent 3f5c1cf753
commit d316d486b9
3 files changed
+37 -74

No files matched your search

+31 -69
View File
@@ -172,71 +172,37 @@ class LoadEvents
// dd($team_id, $value['home_id'], $value['away_id']);
// switch ($value['result_code']) {
// case '1':
// if ($team_id == $value['home_id']) {
// $results['l2']++;
// $results['w']++;
// } else {
// $results['w2']++;
// $results['l']++;
// }
// break;
// case 'X':
// $results['d']++;
// break;
// case '2':
// if ($team_id == $value['home_id']) {
// $results['l']++;
// $results['w2']++;
// } else {
// $results['l2']++;
// $results['w']++;
// }
// break;
// }
switch ($value['result_code']) {
case '1':
if ($team_id == $value['home_id']) {
$results['l2']++;
$results['w']++;
} else {
$results['w2']++;
$results['l']++;
}
break;
case 'X':
$results['d']++;
break;
case '2':
if ($team_id == $value['home_id']) {
$results['l']++;
$results['w2']++;
} else {
$results['l2']++;
$results['w']++;
}
break;
}
$val_home = (int) $value['val_away'];
$val_away = (int) $value['val_home'];
// "match_id" => 14059455
// "sport_id" => 1
// "league_id" => 18
// "home_id" => 9
// "away_id" => 32
// "starttime" => Illuminate\Support\Carbon @1754672400 {#4400 ▶}
// "season" => "25/26"
// "exp_home" => 1.2259626288952
// "exp_away" => 1.1765083700232
// "exp_handicap" => -0.049454258871964
// "exp_total" => 2.4024709989184
// "result_code" => "X"
// "home" => "Birmingham City"
// "away" => "Ipswich Town"
// "val_home" => 1
// "val_away" => 4
// if ($match->home_id == $value['home_id']) {
// $dataset_home[] = (int) $value['val_home'];
// $dataset_away[] = (int) $value['val_away'];
// }
// if ($match->home_id == $value['home_id']) {
// $val_home = (int) $value['val_home'];
// }
// if ($match->away_id == $value['away_id']) {
// $val_away = (int) $value['val_away'];
// }
// if ($team_id == $value['home_id']) {
// $val_away = (int) $value['val_away'];
// $dataset_exp_home[] = (float) round($value['exp_home'], 1);
// $dataset_exp_away[] = (float) round($value['exp_away'], 1);
// } else if ($team_id == $value['away_id']) {
// $val_home = (int) $value['val_away'];
// $val_away = (int) $value['val_home'];
// $dataset_exp_home[] = (float) round($value['exp_away'], 1);
// $dataset_exp_away[] = (float) round($value['exp_home'], 1);
// }
if ($statistic_type == 'gls') {
$dataset_exp_home[] = (float) round($value['exp_away'], 1);
$dataset_exp_away[] = (float) round($value['exp_home'], 1);
}
}
}
if (isset($val_home) && isset($val_away)) {
@@ -263,12 +229,8 @@ class LoadEvents
foreach ($res[$team_position] as $value) {
// dd($value);
// $events[] = $value['home'] . ' vs ' . $value['away'];
// $playing_date[] = $value['starttime']->format('Y-m-d H:i');
// $results_per_event[] = $value['val_home'] . ' : ' . $value['val_away'];
$labels[] = round($value['starttime']->diffInDays(Carbon::now()));
// Home playing HOME done and commited
if ($match->home_id == $value['home_id']) {
$dataset_home[] = (int) $value['val_home'];
@@ -368,7 +330,7 @@ class LoadEvents
];
}
if (!$team_id && isset($dataset_home2) && isset($dataset_away2)) {
if (isset($dataset_home2) && isset($dataset_away2)) {
$data['datasets'][] = [
'label' => $label3,
'events' => $events,
@@ -4,6 +4,7 @@ namespace App\Filament\Widgets\Data\LoadEvents;
use App\Models\SofaScoreTournament;
use App\Models\StatistikoEvent;
use App\Models\Country;
class LoadEventsAverages
{
@@ -17,10 +18,10 @@ class LoadEventsAverages
$statistic_type = $filter['statistic_type'] ?? 'gls';
$res = SofaScoreTournament::with('sofascore_category')->where('tournament_id', $tournament_id)->first();
$season_mode = $res->sofascore_category->country->season_mode;
$country_id = $res->sofascore_category->country_id;
$season_mode = Country::where('id', $country_id)->value('season_mode');
if ($season_mode == 'fullyear') {
$season = date('Y');
} else {
@@ -28,7 +29,7 @@ class LoadEventsAverages
}
$res = StatistikoEvent::where('league_id', $tournament_id)
->where('season', $season)
// ->where('season', $season)
->orderBy('starttime', 'ASC')
->get();
@@ -78,8 +79,6 @@ class LoadEventsAverages
break;
}
// dd($team_position, $team_id, $value);
if ((!$team_position || $team_position == 'all') && ($team_id == $value['home_id'] or $team_id == $value['away_id'])) {
switch ($statistic_type) {
case 'gls':
@@ -109,6 +109,7 @@ class StatsMedianAverage extends StatsOverviewWidget
$lost = 0;
}
if ($total_home) {
$value_home = number_format($summe_home / $total_home, 1);
} else {
@@ -120,6 +121,7 @@ class StatsMedianAverage extends StatsOverviewWidget
$value_away = 0;
}
$max_boxes = 3;
$average_team_home = 0;
$average_team_away = 0;