diff --git a/app/Filament/Widgets/Boxes/ExpectationsTeamNew.php b/app/Filament/Widgets/Boxes/ExpectationsBox3.php similarity index 99% rename from app/Filament/Widgets/Boxes/ExpectationsTeamNew.php rename to app/Filament/Widgets/Boxes/ExpectationsBox3.php index 6ad3f69d..43ac748d 100644 --- a/app/Filament/Widgets/Boxes/ExpectationsTeamNew.php +++ b/app/Filament/Widgets/Boxes/ExpectationsBox3.php @@ -5,7 +5,7 @@ namespace App\Filament\Widgets\Boxes; use App\Filament\Widgets\Boxes\Helper\ExpectationsMinMax; use App\Filament\Widgets\Charts\LoadEvents\LoadEventsQueryAll; -class ExpectationsTeamNew +class ExpectationsBox3 { public static function load(array &$expectations, array $filter, object $match) { @@ -17,7 +17,7 @@ class ExpectationsTeamNew $res = LoadEventsQueryAll::load($filter, $match); - if (! $res) { + if (! $res->count()) { return []; } diff --git a/app/Filament/Widgets/Boxes/ExpectationsTeam.php b/app/Filament/Widgets/Boxes/ExpectationsTeam.php deleted file mode 100644 index 6bb9ff73..00000000 --- a/app/Filament/Widgets/Boxes/ExpectationsTeam.php +++ /dev/null @@ -1,70 +0,0 @@ -home_id, $match->away_id, $value); - ExpectationCollecting::sort($similar_past_matches, $expectations, 'gls', $value->home_id, $value->away_id, $value->gls_h, $value->gls_a, $match); - ExpectationCollecting::sort($similar_past_matches, $expectations, 'fls', $value->home_id, $value->away_id, $value->fls_h, $value->fls_a, $match); - ExpectationCollecting::sort($similar_past_matches, $expectations, 'ofs', $value->home_id, $value->away_id, $value->ofs_h, $value->ofs_a, $match); - ExpectationCollecting::sort($similar_past_matches, $expectations, 'crd', $value->home_id, $value->away_id, $value->crd_h, $value->crd_a, $match); - ExpectationCollecting::sort($similar_past_matches, $expectations, 'snt', $value->home_id, $value->away_id, $value->snt_h, $value->snt_a, $match); - ExpectationCollecting::sort($similar_past_matches, $expectations, 'tsh', $value->home_id, $value->away_id, $value->tsh_h, $value->tsh_a, $match); - ExpectationCollecting::sort($similar_past_matches, $expectations, 'crn', $value->home_id, $value->away_id, $value->crn_h, $value->crn_a, $match); - } - - if ($expectations) { - if (self::$collectionMethod == 'A' or $similar_past_matches != 'none') { - $expectations = ExpectationMethodA::calc($tmp); - } else { - $expectations = ExpectationMethodB::calc($tmp); - - ExpectationsMinMax::calc($expectations, $match); - } - } - - } - - // public static function template() - // { - // $arr = []; - // $bets = ['gls', 'crn', 'fls', 'ofs', 'crd', 'snt', 'tsh']; - // foreach ($bets as $bet) { - // foreach (['team_home', 'team_away'] as $team) { - // foreach (['scored', 'conceded'] as $sc) { - // foreach (['home', 'away'] as $ha) { - // foreach (['evt', 'sum'] as $es) { - // $arr[$bet][$team][$sc][$ha][$es] = 0; - // } - // } - // } - // } - // } - - // return $arr; - // } -} diff --git a/app/Filament/Widgets/Boxes/Helper/ExpectationCollecting.php b/app/Filament/Widgets/Boxes/Helper/ExpectationCollecting.php deleted file mode 100644 index c69696cf..00000000 --- a/app/Filament/Widgets/Boxes/Helper/ExpectationCollecting.php +++ /dev/null @@ -1,90 +0,0 @@ -home_id, $value->away_id, $value->gls_h, $value->gls_a, $match); - public static function sort(string $similar_past_matches, array &$result, string $bettype, int $home_id, int $away_id, float $val_home, float $val_away, object $match) - { - /** - * takes values form statistiko_conf table - * there are 2 mthods A and B noe running B hardcodet - */ - if ($similar_past_matches != 'none') { - $result[$bettype.'_home_made_total'][] = $val_home; - $result[$bettype.'_away_made_total'][] = $val_away; - } elseif (ExpectationsTeam::$collectionMethod == 'B') { - // TEAM HOME - if ($match->home_id == $home_id) { - self::add($result, 'team_home', $bettype, 'scored', 'home', $val_home); - self::add($result, 'team_home', $bettype, 'conceded', 'home', $val_away); - } - - if ($match->home_id == $away_id) { - self::add($result, 'team_home', $bettype, 'scored', 'away', $val_away); - self::add($result, 'team_home', $bettype, 'conceded', 'away', $val_home); - } - - // TEAM AWAY - if ($match->away_id == $home_id) { - self::add($result, 'team_away', $bettype, 'scored', 'home', $val_home); - self::add($result, 'team_away', $bettype, 'conceded', 'home', $val_away); - } - - if ($match->away_id == $away_id) { - self::add($result, 'team_away', $bettype, 'scored', 'away', $val_away); - self::add($result, 'team_away', $bettype, 'conceded', 'away', $val_home); - } - } else { - if ($home_id == $match->home_id) { - $result[$bettype.'_home_made_total'][] = $val_home; - $result[$bettype.'_home_made_home'][] = $val_home; - $result[$bettype.'_home_got_total'][] = $val_away; - $result[$bettype.'_home_got_home'][] = $val_away; - } elseif ($away_id == $match->home_id) { - $result[$bettype.'_home_made_total'][] = $val_away; - $result[$bettype.'_home_got_total'][] = $val_away; - } elseif ($home_id == $match->away_id) { - $result[$bettype.'_home_made_total'][] = $val_away; - $result[$bettype.'_home_got_total'][] = $val_away; - } elseif ($away_id == $match->away_id) { - $result[$bettype.'_home_made_total'][] = $val_home; - $result[$bettype.'_home_made_home'][] = $val_home; - $result[$bettype.'_home_got_total'][] = $val_away; - $result[$bettype.'_home_got_home'][] = $val_home; - } - - if ($away_id == $match->away_id) { - $result[$bettype.'_away_made_total'][] = $val_away; - $result[$bettype.'_away_made_home'][] = $val_away; - $result[$bettype.'_away_got_total'][] = $val_home; - $result[$bettype.'_away_got_home'][] = $val_home; - } elseif ($home_id == $match->away_id) { - $result[$bettype.'_away_made_total'][] = $val_home; - $result[$bettype.'_away_got_total'][] = $val_home; - } elseif ($away_id == $match->home_id) { - $result[$bettype.'_away_made_total'][] = $val_home; - $result[$bettype.'_away_got_total'][] = $val_home; - } elseif ($home_id == $match->home_id) { - $result[$bettype.'_away_made_total'][] = $val_away; - $result[$bettype.'_away_made_home'][] = $val_away; - $result[$bettype.'_away_got_total'][] = $val_home; - $result[$bettype.'_away_got_home'][] = $val_away; - } - } - } - - public static function add(array &$result, string $team, string $bettype, string $scored_conceded, string $location, int $value) - { - if (! isset($result[$bettype][$team][$scored_conceded][$location])) { - $result[$bettype][$team][$scored_conceded][$location]['evt'] = 1; - $result[$bettype][$team][$scored_conceded][$location]['sum'] = $value; - } else { - $result[$bettype][$team][$scored_conceded][$location]['evt']++; - $result[$bettype][$team][$scored_conceded][$location]['sum'] += $value; - } - } -} diff --git a/app/Filament/Widgets/Boxes/LoadEventsBoxes.php b/app/Filament/Widgets/Boxes/LoadEventsBoxes.php index 69ee5ca0..22ff86a4 100644 --- a/app/Filament/Widgets/Boxes/LoadEventsBoxes.php +++ b/app/Filament/Widgets/Boxes/LoadEventsBoxes.php @@ -46,7 +46,7 @@ class LoadEventsBoxes Expectation1X2::load($expectations, $filter, $match); - ExpectationsTeamNew::load($expectations, $filter, $match); + ExpectationsBox3::load($expectations, $filter, $match); if ($team_id == $match->home_id) { $expectations['active_team'] = $match->home->ss_team_name;