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