show second box only if $team_id

This commit is contained in:
salam committed 2026-08-14 20:04:57 +02:00
1 parent 7d76f5bfc5
commit f850c114ab
2 files changed
+16 -15

No files matched your search

@@ -2,7 +2,6 @@
namespace App\Filament\Widgets\Data\LoadEvents;
use App\Models\StatisticFixtures;
use App\Models\StatistikoConfig;
class LoadExpectations
@@ -96,7 +95,7 @@ class LoadExpectations
$count_home += \count($h_got_h);
$count_home = !$count_home ? 1 : $count_home;
$aspettativa_home = round($summe_home / $count_home, 2);
$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;
@@ -108,7 +107,7 @@ class LoadExpectations
$count_away += \count($a_got_a);
$count_away = !$count_away ? 1 : $count_away;
$aspettativa_away = round($summe_away / $count_away, 2);
$aspettativa_away = round($summe_away / $count_away, 1);
return ['home' => $aspettativa_home, 'away' => $aspettativa_away];
}
+14 -12
View File
@@ -34,6 +34,8 @@ class StatsMedianAverage extends StatsOverviewWidget
{
$data = LoadEvents::load($this->filters, false);
$team_id = (int) $this->filters['team_id'] ?? 0;
// Log::debug($data['datasets']);
$team_position = HelperTeamPosition::get($this->filters);
@@ -64,16 +66,16 @@ class StatsMedianAverage extends StatsOverviewWidget
$away_team = $data['away_team'];
}
if ($arr_home) {
$median_home = self::getMedian($arr_home);
} else {
$median_home = 0;
}
if ($arr_away) {
$median_away = self::getMedian($arr_away);
} else {
$median_away = 0;
}
// if ($arr_home) {
// $median_home = self::getMedian($arr_home);
// } else {
// $median_home = 0;
// }
// if ($arr_away) {
// $median_away = self::getMedian($arr_away);
// } else {
// $median_away = 0;
// }
if (isset($data['results'])) {
// Log::debug($data['results']);
@@ -84,12 +86,12 @@ class StatsMedianAverage extends StatsOverviewWidget
return [];
}
if ($total_home) {
if ($total_home && $team_id) {
$value_home = number_format($summe_home / $total_home, 1);
} else {
$value_home = 0;
}
if ($total_away) {
if ($total_away && $team_id) {
$value_away = number_format($summe_away / $total_away, 1);
} else {
$value_away = 0;