wip fix
This commit is contained in:
1 parent
9bcd4432c6
commit
6f92f9e1d5
1209 files changed
+220940
No files matched your search
@@ -0,0 +1,12 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Widgets\Boxes\Helper;
|
||||
|
||||
class ExpectationAverage
|
||||
{
|
||||
public static function filter(array &$result, string $type, string $bettype, float $val_home, float $val_away)
|
||||
{
|
||||
$result[$type][$bettype]['home'][] = (int) $val_home;
|
||||
$result[$type][$bettype]['away'][] = (int) $val_away;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Widgets\Boxes\Helper;
|
||||
|
||||
use App\Models\StatistikoConfig;
|
||||
|
||||
class ExpectationCalculation
|
||||
{
|
||||
public static function calc(array $expectations)
|
||||
{
|
||||
$summen = [];
|
||||
$config = StatistikoConfig::pluck('value', 'varname');
|
||||
foreach ($config as $name => $value) {
|
||||
if (isset($expectations[$name])) {
|
||||
$summen[$name]['sum'] = array_sum($expectations[$name]) * $value;
|
||||
$summen[$name]['cnt'] = \count($expectations[$name]);
|
||||
} else {
|
||||
$summen[$name]['sum'] = 0;
|
||||
$summen[$name]['cnt'] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
$summen2 = [];
|
||||
$bets = ['gls', 'fls', 'ofs', 'crd', 'snt', 'tsh'];
|
||||
foreach ($bets as $name) {
|
||||
$summen2[$name]['home']['sum'] = 0;
|
||||
$summen2[$name]['home']['cnt'] = 0;
|
||||
$summen2[$name]['away']['sum'] = 0;
|
||||
$summen2[$name]['away']['cnt'] = 0;
|
||||
}
|
||||
|
||||
foreach ($summen as $key => $value) {
|
||||
foreach ($bets as $name) {
|
||||
if (strpos($key, $name) !== false) {
|
||||
if (strpos($key, 'home') !== false) {
|
||||
$summen2[$name]['home']['sum'] += $value['sum'];
|
||||
$summen2[$name]['home']['cnt'] += +$value['cnt'];
|
||||
}
|
||||
if (strpos($key, 'away') !== false) {
|
||||
$summen2[$name]['away']['sum'] += $value['sum'];
|
||||
$summen2[$name]['away']['cnt'] += +$value['cnt'];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
$asp_result = [];
|
||||
foreach ($summen2 as $bettype => $value) {
|
||||
$asp_result[$bettype]['home'] = round($value['home']['sum'] / $value['home']['cnt'], 1);
|
||||
$asp_result[$bettype]['away'] = round($value['away']['sum'] / $value['away']['cnt'], 1);
|
||||
}
|
||||
|
||||
return $asp_result;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Widgets\Boxes\Helper;
|
||||
|
||||
class ExpectationCollecting
|
||||
{
|
||||
public static function sort(array &$result, string $type, int $home_id, int $away_id, float $val_home, float $val_away, object $match)
|
||||
{
|
||||
|
||||
if ($home_id == $match->home_id) {
|
||||
$result[$type.'_home_made_total'][] = $val_home;
|
||||
$result[$type.'_home_made_home'][] = $val_home;
|
||||
$result[$type.'_home_got_total'][] = $val_away;
|
||||
$result[$type.'_home_got_home'][] = $val_away;
|
||||
} elseif ($away_id == $match->home_id) {
|
||||
$result[$type.'_home_made_total'][] = $val_away;
|
||||
$result[$type.'_home_got_total'][] = $val_away;
|
||||
} elseif ($home_id == $match->away_id) {
|
||||
$result[$type.'_home_made_total'][] = $val_away;
|
||||
$result[$type.'_home_got_total'][] = $val_away;
|
||||
} elseif ($away_id == $match->away_id) {
|
||||
$result[$type.'_home_made_total'][] = $val_home;
|
||||
$result[$type.'_home_made_home'][] = $val_home;
|
||||
$result[$type.'_home_got_total'][] = $val_away;
|
||||
$result[$type.'_home_got_home'][] = $val_home;
|
||||
}
|
||||
|
||||
if ($away_id == $match->away_id) {
|
||||
$result[$type.'_away_made_total'][] = $val_away;
|
||||
$result[$type.'_away_made_home'][] = $val_away;
|
||||
$result[$type.'_away_got_total'][] = $val_home;
|
||||
$result[$type.'_away_got_home'][] = $val_home;
|
||||
} elseif ($home_id == $match->away_id) {
|
||||
$result[$type.'_away_made_total'][] = $val_home;
|
||||
$result[$type.'_away_got_total'][] = $val_home;
|
||||
} elseif ($away_id == $match->home_id) {
|
||||
$result[$type.'_away_made_total'][] = $val_home;
|
||||
$result[$type.'_away_got_total'][] = $val_home;
|
||||
} elseif ($home_id == $match->home_id) {
|
||||
$result[$type.'_away_made_total'][] = $val_away;
|
||||
$result[$type.'_away_made_home'][] = $val_away;
|
||||
$result[$type.'_away_got_total'][] = $val_home;
|
||||
$result[$type.'_away_got_home'][] = $val_away;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user