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
+146 -110

No files matched your search

+14 -9
View File
@@ -11,18 +11,23 @@ class LoadSeasons
// $res = CompetitionGroup::with('country')->where('id', $league_id)->first();
// $season_mode = $res->country->season_mode;
$res = StatistikoEvent::select('season')->where('league_id', $league_id)->get();
// $res = StatistikoEvent::query()->where('league_id', $league_id)->get();
if (! $res) {
return [];
}
// if (! $res) {
// return [];
// }
// $arr = [];
// foreach ($res as $val) {
// $arr[$val->season] = $val->season;
// }
// asort($arr);
$arr = [];
foreach ($res as $val) {
$arr[$val->season] = $val->season;
}
asort($arr);
$arr['24/25'] = '24/25';
$arr['25/26'] = '25/26';
$arr['26/27'] = '26/27';
return $arr;
}
+10 -4
View File
@@ -79,6 +79,7 @@ class Statistic extends BaseDashboard
Select::make('sofascore_category_id')
->live()
->preload()
->searchable(false)
->prefixIconColor(fn (Get $get): string => $get('sofascore_category_id') ? 'success' : 'danger')
->prefixIcon('phosphor-globe-fill')
->hiddenLabel()
@@ -314,6 +315,7 @@ class Statistic extends BaseDashboard
Select::make('season')
->live()
->columns(2)
->searchable(false)
->hiddenLabel()
->multiple()
->placeholder('Current Season')
@@ -321,10 +323,14 @@ class Statistic extends BaseDashboard
// ->prefixIconColor(fn(Get $get): string => $get('season') ? 'success' : 'primary')
->hidden(fn (Get $get) => $get('season_or_date') == 'date')
->prefixIcon('phosphor-calendar-star-fill')
->preload()
->options(function (Get $get) {
return LoadSeasons::load($get('league_id'));
})
->options([
'26/27' => '26/27',
'25/26' => '25/26',
'24/25' => '24/25',
])
// ->options(function (Get $get) {
// return LoadSeasons::load($get('league_id'));
// })
->afterStateUpdated(function (callable $set) {
$set('ss_player_id', null);
}),
+5 -16
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 = [];
@@ -104,6 +104,9 @@ class LoadEvents
$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']) {
case '1':
@@ -119,9 +122,6 @@ 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);
@@ -142,9 +142,6 @@ 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);
@@ -165,9 +162,6 @@ 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);
@@ -200,9 +194,6 @@ 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);
@@ -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 = [
@@ -363,7 +353,6 @@ class LoadEvents
// dd($data);
/**
* LEAGUE AVERAGES
*/
@@ -84,8 +84,6 @@ class LoadEventsQuery
/**
* STATTISTIC DATA
*/
// dd($team_id, $home_id, $away_id);
$res = StatistikoEvent::with('home')->with('away')
->where(function ($query) use ($league_id, $similar_past_matches) {
@@ -122,13 +120,14 @@ class LoadEventsQuery
return $query->whereDate('starttime', '<=', $end);
})
->when($season, function ($query) use ($season, $season_or_date) {
if ($season_or_date == 'season')
if ($season_or_date == 'season') {
return $query->whereIn('season', $season);
}
})
->orderBy('starttime', 'ASC')
->get();
// dd($season, $res);
// dd($season, $team_id, $home_id, $away_id, $res);
$arr = [];
foreach ($res as $value) {
@@ -181,11 +180,13 @@ class LoadEventsQuery
}
$arr['all'][] = $tmp;
if ($value->home_id == $team_id)
if ($value->home_id == $team_id) {
$arr['home'][] = $tmp;
if ($value->away_id == $team_id)
}
if ($value->away_id == $team_id) {
$arr['away'][] = $tmp;
}
}
return $arr;
}
@@ -11,100 +11,139 @@ class LoadExpectations
$home_id = $match->home_id;
$away_id = $match->away_id;
// dd($data, $match);
$config = StatistikoConfig::where('group', $statistic_type)->get();
$home_made_total = 1;
$home_made_home = 1;
$home_got_total = 1;
$home_got_home = 1;
$away_made_total = 1;
$away_made_home = 1;
$away_got_total = 1;
$away_got_home = 1;
$uba_home_made_total = 1;
$uba_home_made_home = 1;
$uba_home_got_total = 1;
$uba_home_got_home = 1;
$uba_away_made_total = 1;
$uba_away_made_home = 1;
$uba_away_got_total = 1;
$uba_away_got_home = 1;
foreach ($config as $value) {
$varname = str_replace($statistic_type.'_', '', $value->varname);
switch ($varname) {
case 'home_made_total':
$home_made_total = (float) $value->value;
$uba_home_made_total = (float) $value->value;
break;
case 'home_made_home':
$home_made_home = (float) $value->value;
$uba_home_made_home = (float) $value->value;
break;
case 'home_got_total':
$home_got_total = (float) $value->value;
$uba_home_got_total = (float) $value->value;
break;
case 'home_got_home':
$home_got_home = (float) $value->value;
$uba_home_got_home = (float) $value->value;
break;
case 'away_made_total':
$away_made_total = (float) $value->value;
$uba_away_made_total = (float) $value->value;
break;
case 'away_made_home':
$away_made_home = (float) $value->value;
$uba_away_made_home = (float) $value->value;
break;
case 'away_got_total':
$away_got_total = (float) $value->value;
$uba_away_got_total = (float) $value->value;
break;
case 'away_got_home':
$away_got_home = (float) $value->value;
$uba_away_got_home = (float) $value->value;
break;
}
}
$h_made_t = [];
$h_made_h = [];
$h_got_t = [];
$h_got_h = [];
$home_made_total = [];
$home_made_home = [];
$home_got_total = [];
$home_got_home = [];
$a_made_t = [];
$a_made_a = [];
$a_got_t = [];
$a_got_a = [];
$away_made_total = [];
$away_made_away = [];
$away_got_total = [];
$away_got_away = [];
foreach ($data as $value) {
// HOME
if ($value['home_id'] == $home_id || $value['away_id'] == $home_id) {
$h_made_t[] = $value['val_home'];
$h_got_t[] = $value['val_away'];
}
if ($value['home_id'] == $home_id) {
$h_made_h[] = $value['val_home'];
$h_got_h[] = $value['val_away'];
}
// if ($value['home_id'] == $home_id || $value['away_id'] == $home_id) {
// $home_made_total[] = $value['val_home'];
// $home_got_total[] = $value['val_away'];
// }
// if ($value['home_id'] == $home_id) {
// $home_made_home[] = $value['val_home'];
// $home_got_home[] = $value['val_away'];
// }
// AWAY
if ($value['home_id'] == $away_id || $value['away_id'] == $away_id) {
$a_made_t[] = $value['val_away'];
$a_made_a[] = $value['val_home'];
// if ($value['home_id'] == $away_id || $value['away_id'] == $away_id) {
// $away_made_total[] = $value['val_away'];
// $away_made_away[] = $value['val_home'];
// }
// if ($value['away_id'] == $away_id) {
// $away_made_away[] = $value['val_away'];
// $away_got_away[] = $value['val_home'];
// }
if ($value['home_id'] == $home_id) {
$home_made_total[] = $value['val_home'];
$home_made_home[] = $value['val_home'];
$home_got_total[] = $value['val_away'];
$home_got_home[] = $value['val_away'];
} elseif ($value['away_id'] == $home_id) {
$home_made_total[] = $value['val_away'];
$home_got_total[] = $value['val_away'];
} elseif ($value['home_id'] == $away_id) {
$home_made_total[] = $value['val_away'];
$home_got_total[] = $value['val_away'];
} elseif ($value['away_id'] == $away_id) {
$home_made_total[] = $value['val_home'];
$home_made_home[] = $value['val_home'];
$home_got_total[] = $value['val_away'];
$home_got_home[] = $value['val_home'];
}
if ($value['away_id'] == $away_id) {
$a_made_a[] = $value['val_away'];
$a_got_a[] = $value['val_home'];
}
$away_made_total[] = $value['val_away'];
$away_made_away[] = $value['val_away'];
$away_got_total[] = $value['val_home'];
$away_got_away[] = $value['val_home'];
} elseif ($value['home_id'] == $away_id) {
$away_made_total[] = $value['val_home'];
$away_got_total[] = $value['val_home'];
} elseif ($value['away_id'] == $home_id) {
$away_made_total[] = $value['val_home'];
$away_got_total[] = $value['val_home'];
} elseif ($value['home_id'] == $home_id) {
$away_made_total[] = $value['val_away'];
$away_made_away[] = $value['val_away'];
$away_got_total[] = $value['val_home'];
$away_got_away[] = $value['val_away'];
}
$summe_home = array_sum($h_made_t) * $home_made_total;
$summe_home += array_sum($h_made_h) * $home_made_home;
$summe_home += array_sum($h_got_t) * $home_got_total;
$summe_home += array_sum($h_got_h) * $home_got_home;
$count_home = \count($h_made_t);
$count_home += \count($h_made_h);
$count_home += \count($h_got_t);
$count_home += \count($h_got_h);
}
$summe_home = array_sum($home_made_total) * $uba_home_made_total;
$summe_home += array_sum($home_made_home) * $uba_home_made_home;
$summe_home += array_sum($home_got_total) * $uba_home_got_total;
$summe_home += array_sum($home_got_home) * $uba_home_got_home;
$count_home = \count($home_made_total);
$count_home += \count($home_made_home);
$count_home += \count($home_got_total);
$count_home += \count($home_got_home);
$count_home = ! $count_home ? 1 : $count_home;
$aspettativa_home = round($summe_home / $count_home, 1);
$summe_away = array_sum($a_made_t) * $away_made_total;
$summe_away += array_sum($a_made_a) * $away_made_home;
$summe_away += array_sum($a_got_t) * $away_got_total;
$summe_away += array_sum($a_got_a) * $away_got_home;
$count_away = \count($a_made_t);
$count_away += \count($a_made_a);
$count_away += \count($a_got_t);
$count_away += \count($a_got_a);
$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_got_total) * $uba_away_got_total;
$summe_away += array_sum($away_got_away) * $uba_away_got_home;
$count_away = \count($away_made_total);
$count_away += \count($away_made_away);
$count_away += \count($away_got_total);
$count_away += \count($away_got_away);
$count_away = ! $count_away ? 1 : $count_away;
$aspettativa_away = round($summe_away / $count_away, 1);
+9 -9
View File
@@ -12,6 +12,7 @@ use Filament\Widgets\StatsOverviewWidget\Stat;
use Illuminate\Support\Carbon;
use Illuminate\Support\HtmlString;
use Livewire\Attributes\Reactive;
// use Illuminate\Support\Facades\Log;
class StatsMedianAverage extends StatsOverviewWidget
@@ -45,10 +46,11 @@ class StatsMedianAverage extends StatsOverviewWidget
switch ($season_or_date) {
case 'season':
if ($season)
if ($season) {
$date_events = implode(', ', $season);
else
} else {
$date_events = 'Current Season';
}
break;
default:
$start = $this->filters['start_date'] ?? 0;
@@ -59,13 +61,15 @@ class StatsMedianAverage extends StatsOverviewWidget
$tmp[] = 'From: '.Carbon::createFromDate($start)->format('Y-m-d');
}
if ($end)
if ($end) {
$tmp[] = 'To: '.Carbon::createFromDate($end)->format('Y-m-d');
}
if ($tmp)
if ($tmp) {
$date_events = implode('<br>', $tmp);
else
} else {
$date_events = 'All Dates';
}
break;
}
@@ -77,7 +81,6 @@ class StatsMedianAverage extends StatsOverviewWidget
$statistic_type = HelperStatisticType::get($this->filters);
if (! isset($data['datasets'][0])) {
$data['datasets'][0]['data'] = [];
$data['datasets'][1]['data'] = [];
@@ -108,7 +111,6 @@ class StatsMedianAverage extends StatsOverviewWidget
$lost = 0;
}
if ($total_home) {
$value_home = number_format($summe_home / $total_home, 1);
} else {
@@ -120,7 +122,6 @@ class StatsMedianAverage extends StatsOverviewWidget
$value_away = 0;
}
$max_boxes = 3;
$average_team_home = 0;
$average_team_away = 0;
@@ -310,7 +311,6 @@ class StatsMedianAverage extends StatsOverviewWidget
</div>');
}
protected function getMedian(array $arr)
{
sort($arr);
Generated
+8 -12
View File
@@ -4705,24 +4705,24 @@
},
{
"name": "mongodb/mongodb",
"version": "2.2.0",
"version": "2.3.0",
"source": {
"type": "git",
"url": "https://github.com/mongodb/mongo-php-library.git",
"reference": "bbb13f969e37e047fd822527543df55fdc1c9298"
"url": "https://github.com/mongodb/mongo-php-library",
"reference": "12e56461166d915e3dd8e4969ad0940ed5207d88"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mongodb/mongo-php-library/zipball/bbb13f969e37e047fd822527543df55fdc1c9298",
"reference": "bbb13f969e37e047fd822527543df55fdc1c9298",
"url": "https://api.github.com/repos/mongodb/mongo-php-library/zipball/12e56461166d915e3dd8e4969ad0940ed5207d88",
"reference": "12e56461166d915e3dd8e4969ad0940ed5207d88",
"shasum": ""
},
"require": {
"composer-runtime-api": "^2.0",
"ext-mongodb": "^2.2",
"ext-mongodb": "^2.3",
"php": "^8.1",
"psr/log": "^1.1.4|^2|^3",
"symfony/polyfill-php85": "^1.32"
"symfony/polyfill-php85": "^1.33"
},
"replace": {
"mongodb/builder": "*"
@@ -4774,11 +4774,7 @@
"mongodb",
"persistence"
],
"support": {
"issues": "https://github.com/mongodb/mongo-php-library/issues",
"source": "https://github.com/mongodb/mongo-php-library/tree/2.2.0"
},
"time": "2026-02-11T11:39:56+00:00"
"time": "2026-04-28T12:50:06+00:00"
},
{
"name": "monolog/monolog",