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']); // dd($team_id, $value['home_id'], $value['away_id']);
// switch ($value['result_code']) { switch ($value['result_code']) {
// case '1': case '1':
// if ($team_id == $value['home_id']) { if ($team_id == $value['home_id']) {
// $results['l2']++; $results['l2']++;
// $results['w']++; $results['w']++;
// } else { } else {
// $results['w2']++; $results['w2']++;
// $results['l']++; $results['l']++;
// } }
// break; break;
// case 'X': case 'X':
// $results['d']++; $results['d']++;
// break; break;
// case '2': case '2':
// if ($team_id == $value['home_id']) { if ($team_id == $value['home_id']) {
// $results['l']++; $results['l']++;
// $results['w2']++; $results['w2']++;
// } else { } else {
// $results['l2']++; $results['l2']++;
// $results['w']++; $results['w']++;
// } }
// break; break;
// } }
$val_home = (int) $value['val_away'];
$val_away = (int) $value['val_home'];
// "match_id" => 14059455 if ($statistic_type == 'gls') {
// "sport_id" => 1 $dataset_exp_home[] = (float) round($value['exp_away'], 1);
// "league_id" => 18 $dataset_exp_away[] = (float) round($value['exp_home'], 1);
// "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 (isset($val_home) && isset($val_away)) { if (isset($val_home) && isset($val_away)) {
@@ -263,12 +229,8 @@ class LoadEvents
foreach ($res[$team_position] as $value) { 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())); $labels[] = round($value['starttime']->diffInDays(Carbon::now()));
// Home playing HOME done and commited // Home playing HOME done and commited
if ($match->home_id == $value['home_id']) { if ($match->home_id == $value['home_id']) {
$dataset_home[] = (int) $value['val_home']; $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'][] = [ $data['datasets'][] = [
'label' => $label3, 'label' => $label3,
'events' => $events, 'events' => $events,
@@ -4,6 +4,7 @@ namespace App\Filament\Widgets\Data\LoadEvents;
use App\Models\SofaScoreTournament; use App\Models\SofaScoreTournament;
use App\Models\StatistikoEvent; use App\Models\StatistikoEvent;
use App\Models\Country;
class LoadEventsAverages class LoadEventsAverages
{ {
@@ -17,10 +18,10 @@ class LoadEventsAverages
$statistic_type = $filter['statistic_type'] ?? 'gls'; $statistic_type = $filter['statistic_type'] ?? 'gls';
$res = SofaScoreTournament::with('sofascore_category')->where('tournament_id', $tournament_id)->first(); $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') { if ($season_mode == 'fullyear') {
$season = date('Y'); $season = date('Y');
} else { } else {
@@ -28,7 +29,7 @@ class LoadEventsAverages
} }
$res = StatistikoEvent::where('league_id', $tournament_id) $res = StatistikoEvent::where('league_id', $tournament_id)
->where('season', $season) // ->where('season', $season)
->orderBy('starttime', 'ASC') ->orderBy('starttime', 'ASC')
->get(); ->get();
@@ -78,8 +79,6 @@ class LoadEventsAverages
break; break;
} }
// dd($team_position, $team_id, $value);
if ((!$team_position || $team_position == 'all') && ($team_id == $value['home_id'] or $team_id == $value['away_id'])) { if ((!$team_position || $team_position == 'all') && ($team_id == $value['home_id'] or $team_id == $value['away_id'])) {
switch ($statistic_type) { switch ($statistic_type) {
case 'gls': case 'gls':
@@ -109,6 +109,7 @@ class StatsMedianAverage extends StatsOverviewWidget
$lost = 0; $lost = 0;
} }
if ($total_home) { if ($total_home) {
$value_home = number_format($summe_home / $total_home, 1); $value_home = number_format($summe_home / $total_home, 1);
} else { } else {
@@ -120,6 +121,7 @@ class StatsMedianAverage extends StatsOverviewWidget
$value_away = 0; $value_away = 0;
} }
$max_boxes = 3; $max_boxes = 3;
$average_team_home = 0; $average_team_home = 0;
$average_team_away = 0; $average_team_away = 0;