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