fix box 1

This commit is contained in:
salam committed 2026-08-30 07:25:28 +02:00
1 parent 4ec3a86c9e
commit c49f5e2364
7 files changed
+230 -194

No files matched your search

+26 -37
View File
@@ -52,7 +52,6 @@ class LoadEvents
$team_position = '';
$exp_handicap = $match->exp_away - $match->exp_home;
$exp_total = $match->exp_away + $match->exp_home;
@@ -71,9 +70,10 @@ class LoadEvents
/**
* STATTISTIC DATA
*/
$res = LoadEventsQuery::load($filter, $handicap_range, $total_range, $match);
// dd($res);
$dataset_home = [];
$dataset_away = [];
$dataset_exp_home = [];
@@ -84,11 +84,11 @@ class LoadEvents
$events = [];
$results = ['w' => 0, 'd' => 0, 'l' => 0, 'w2' => 0, 'l2' => 0];
if (!$team_id || !\in_array($team_position, ['home', 'away'])) {
if (! $team_id || ! \in_array($team_position, ['home', 'away'])) {
$team_position = 'all';
}
if (!isset($res['all']) || !isset($res[$team_position])) {
if (! isset($res['all']) || ! isset($res[$team_position])) {
return [];
}
@@ -102,7 +102,10 @@ class LoadEvents
$playing_date[] = $value['starttime']->format('Y-m-d H:i');
$results_per_event[] = $value['val_home'] . ' : ' . $value['val_away'];
$results_per_event[] = $value['val_home'].' : '.$value['val_away'];
$val_home = (int) $value['val_home'];
$val_away = (int) $value['val_away'];
if ($similar_past_matches != 'none') {
switch ($value['result_code']) {
@@ -119,12 +122,9 @@ class LoadEvents
break;
}
$val_home = (int) $value['val_home'];
$val_away = (int) $value['val_away'];
if ($statistic_type == 'gls') {
$dataset_exp_home[] = (float) round($value['exp_home'], 1);
$dataset_exp_away[] = (float) round($value['exp_away'], 1);
$dataset_exp_home[] = (float) round($value['exp_home'], 1);
$dataset_exp_away[] = (float) round($value['exp_away'], 1);
}
} else {
if ($team_position == 'home') {
@@ -142,12 +142,9 @@ class LoadEvents
break;
}
$val_home = (int) $value['val_home'];
$val_away = (int) $value['val_away'];
if ($statistic_type == 'gls') {
$dataset_exp_home[] = (float) round($value['exp_home'], 1);
$dataset_exp_away[] = (float) round($value['exp_away'], 1);
$dataset_exp_home[] = (float) round($value['exp_home'], 1);
$dataset_exp_away[] = (float) round($value['exp_away'], 1);
}
} elseif ($team_position == 'away') {
@@ -165,12 +162,9 @@ class LoadEvents
break;
}
$val_home = (int) $value['val_away'];
$val_away = (int) $value['val_home'];
if ($statistic_type == 'gls') {
$dataset_exp_home[] = (float) round($value['exp_away'], 1);
$dataset_exp_away[] = (float) round($value['exp_home'], 1);
$dataset_exp_home[] = (float) round($value['exp_away'], 1);
$dataset_exp_away[] = (float) round($value['exp_home'], 1);
}
} else {
@@ -200,17 +194,14 @@ class LoadEvents
break;
}
$val_home = (int) $value['val_away'];
$val_away = (int) $value['val_home'];
if ($statistic_type == 'gls') {
$dataset_exp_home[] = (float) round($value['exp_away'], 1);
$dataset_exp_away[] = (float) round($value['exp_home'], 1);
$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)) {
$events[] = $value['home'] . ' vs ' . $value['away'];
$events[] = $value['home'].' vs '.$value['away'];
$dataset_home[] = $val_home;
$dataset_away[] = $val_away;
}
@@ -224,10 +215,10 @@ class LoadEvents
$label2 = 'Against';
}
} else {
$label1 = $match->home->ss_team_name . ' +';
$label2 = $match->home->ss_team_name . ' -';
$label3 = $match->away->ss_team_name . ' +';
$label4 = $match->away->ss_team_name . ' -';
$label1 = $match->home->ss_team_name.' +';
$label2 = $match->home->ss_team_name.' -';
$label3 = $match->away->ss_team_name.' +';
$label4 = $match->away->ss_team_name.' -';
$dataset_home2 = [];
$dataset_away2 = [];
@@ -239,15 +230,15 @@ class LoadEvents
if ($match->home_id == $value['home_id']) {
$dataset_home[] = (int) $value['val_home'];
$dataset_away[] = (int) $value['val_away'];
} else if ($match->home_id == $value['away_id']) {
} elseif ($match->home_id == $value['away_id']) {
$dataset_home[] = (int) $value['val_away'];
$dataset_away[] = (int) $value['val_home'];
}
// Home playing AWAY done and commited
else if ($match->away_id == $value['home_id']) {
elseif ($match->away_id == $value['home_id']) {
$dataset_home2[] = (int) $value['val_home'];
$dataset_away2[] = (int) $value['val_away'];
} else if ($match->away_id == $value['away_id']) {
} elseif ($match->away_id == $value['away_id']) {
$dataset_home2[] = (int) $value['val_away'];
$dataset_away2[] = (int) $value['val_home'];
}
@@ -263,7 +254,6 @@ class LoadEvents
// dd($events, count($dataset_home), count($dataset_away), count($dataset_home2), count($dataset_away2));
self::shortenEnding($labels, $dataset_home, $dataset_away);
$data = [
@@ -309,7 +299,7 @@ class LoadEvents
];
if ($team_id && $statistic_type == 'gls') {
$data['datasets'][] = [
'label' => 'Goals ' . $label1,
'label' => 'Goals '.$label1,
'events' => $events,
'playing_date' => $playing_date,
'results_per_event' => $results_per_event,
@@ -321,7 +311,7 @@ class LoadEvents
'hidden' => true,
];
$data['datasets'][] = [
'label' => 'Goals ' . $label2,
'label' => 'Goals '.$label2,
'events' => $events,
'playing_date' => $playing_date,
'results_per_event' => $results_per_event,
@@ -363,7 +353,6 @@ class LoadEvents
// dd($data);
/**
* LEAGUE AVERAGES
*/