diff --git a/app/Filament/Widgets/Boxes/ExpectationsTeam.php b/app/Filament/Widgets/Boxes/ExpectationsTeam.php index 5b89302b..f88d958d 100644 --- a/app/Filament/Widgets/Boxes/ExpectationsTeam.php +++ b/app/Filament/Widgets/Boxes/ExpectationsTeam.php @@ -31,6 +31,7 @@ class ExpectationsTeam } $res = LoadEventsQueryAll::load($filter, $match); + $count_events_selection = $res->count(); $count_events = ExpectationCounting::count($team_position, $team_id, $res); @@ -61,6 +62,7 @@ class ExpectationsTeam $expectations['tsh']['name'] = 'Total Shots'; $expectations['home'] = $home_team; $expectations['away'] = $away_team; + $expectations['count_events'] = $count_events; $expectations += ['win_count' => 0, 'draw_count' => 0, 'lost_count' => 0]; foreach ($res as $value) { @@ -103,9 +105,8 @@ class ExpectationsTeam } } - $expectations['win_odd'] = $expectations['win_count'] ? number_format(Round::odd($count_events / $expectations['win_count']), 2) : 0; - $expectations['draw_odd'] = $expectations['draw_count'] ? number_format(Round::odd($count_events / $expectations['draw_count']), 2) : 0; - $expectations['lost_odd'] = $expectations['lost_count'] ? number_format(Round::odd($count_events / $expectations['lost_count']), 2) : 0; - $expectations['count_events'] = $count_events; + $expectations['win_odd'] = $expectations['win_count'] ? number_format(Round::odd($count_events_selection / $expectations['win_count']), 2) : 0; + $expectations['draw_odd'] = $expectations['draw_count'] ? number_format(Round::odd($count_events_selection / $expectations['draw_count']), 2) : 0; + $expectations['lost_odd'] = $expectations['lost_count'] ? number_format(Round::odd($count_events_selection / $expectations['lost_count']), 2) : 0; } }