wip
This commit is contained in:
1 parent
e52722d3e1
commit
d5713472fc
4 files changed
+3
-163
No files matched your search
+2
-2
@@ -5,7 +5,7 @@ namespace App\Filament\Widgets\Boxes;
|
|||||||
use App\Filament\Widgets\Boxes\Helper\ExpectationsMinMax;
|
use App\Filament\Widgets\Boxes\Helper\ExpectationsMinMax;
|
||||||
use App\Filament\Widgets\Charts\LoadEvents\LoadEventsQueryAll;
|
use App\Filament\Widgets\Charts\LoadEvents\LoadEventsQueryAll;
|
||||||
|
|
||||||
class ExpectationsTeamNew
|
class ExpectationsBox3
|
||||||
{
|
{
|
||||||
public static function load(array &$expectations, array $filter, object $match)
|
public static function load(array &$expectations, array $filter, object $match)
|
||||||
{
|
{
|
||||||
@@ -17,7 +17,7 @@ class ExpectationsTeamNew
|
|||||||
|
|
||||||
$res = LoadEventsQueryAll::load($filter, $match);
|
$res = LoadEventsQueryAll::load($filter, $match);
|
||||||
|
|
||||||
if (! $res) {
|
if (! $res->count()) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1,70 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Widgets\Boxes;
|
|
||||||
|
|
||||||
use App\Filament\Widgets\Boxes\Helper\ExpectationCollecting;
|
|
||||||
use App\Filament\Widgets\Boxes\Helper\ExpectationMethodA;
|
|
||||||
use App\Filament\Widgets\Boxes\Helper\ExpectationMethodB;
|
|
||||||
use App\Filament\Widgets\Boxes\Helper\ExpectationsMinMax;
|
|
||||||
use App\Filament\Widgets\Charts\LoadEvents\LoadEventsQueryAll;
|
|
||||||
|
|
||||||
class ExpectationsTeam
|
|
||||||
{
|
|
||||||
public static $collectionMethod = 'B';
|
|
||||||
|
|
||||||
public static function load(array &$expectations, array $filter, object $match)
|
|
||||||
{
|
|
||||||
/**
|
|
||||||
* STATTISTIC DATA
|
|
||||||
*/
|
|
||||||
$similar_past_matches = $filter['similar_past_matches'];
|
|
||||||
|
|
||||||
$res = LoadEventsQueryAll::load($filter, $match);
|
|
||||||
|
|
||||||
if (! $res) {
|
|
||||||
return [];
|
|
||||||
}
|
|
||||||
|
|
||||||
$tmp = [];
|
|
||||||
foreach ($res as $value) {
|
|
||||||
// dd($match->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;
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
@@ -1,90 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace App\Filament\Widgets\Boxes\Helper;
|
|
||||||
|
|
||||||
use App\Filament\Widgets\Boxes\ExpectationsTeam;
|
|
||||||
|
|
||||||
class ExpectationCollecting
|
|
||||||
{
|
|
||||||
// ExpectationCollecting::sort($similar_past_matches, $tmp, 'gls', $value->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;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -46,7 +46,7 @@ class LoadEventsBoxes
|
|||||||
|
|
||||||
Expectation1X2::load($expectations, $filter, $match);
|
Expectation1X2::load($expectations, $filter, $match);
|
||||||
|
|
||||||
ExpectationsTeamNew::load($expectations, $filter, $match);
|
ExpectationsBox3::load($expectations, $filter, $match);
|
||||||
|
|
||||||
if ($team_id == $match->home_id) {
|
if ($team_id == $match->home_id) {
|
||||||
$expectations['active_team'] = $match->home->ss_team_name;
|
$expectations['active_team'] = $match->home->ss_team_name;
|
||||||
|
|||||||
Reference in new issue
Block a user