wip
This commit is contained in:
1 parent
8cb1d428cb
commit
0a936bc84b
6 files changed
+190
-100
No files matched your search
+1
-1
@@ -4,7 +4,7 @@ namespace App\Filament\Widgets\Boxes\Helper;
|
||||
|
||||
use App\Models\StatistikoConfig;
|
||||
|
||||
class ExpectationCalculation
|
||||
class ExpectationCalculationMethodA
|
||||
{
|
||||
public static function calc(array $expectations)
|
||||
{
|
||||
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Widgets\Boxes\Helper;
|
||||
|
||||
class ExpectationCalculationMethodB
|
||||
{
|
||||
public static function calc(array $expectations)
|
||||
{
|
||||
|
||||
// ok in pratica made = scored e got = conceded
|
||||
|
||||
$cfHA = 2;
|
||||
|
||||
$result = [];
|
||||
foreach ($expectations as $bettype => $data) {
|
||||
$result[$bettype]['home'] = round((
|
||||
$data['team_home']['scored']['home']['sum'] * $cfHA +
|
||||
$data['team_home']['scored']['away']['sum'] +
|
||||
$data['team_away']['conceded']['away']['sum'] * $cfHA +
|
||||
$data['team_away']['conceded']['home']['sum']
|
||||
) / (
|
||||
$data['team_home']['scored']['home']['evt'] * $cfHA +
|
||||
$data['team_home']['scored']['away']['evt'] +
|
||||
$data['team_away']['conceded']['home']['evt'] +
|
||||
$data['team_away']['conceded']['away']['evt'] * $cfHA
|
||||
), 1);
|
||||
$result[$bettype]['away'] = round((
|
||||
$data['team_home']['conceded']['home']['sum'] * $cfHA +
|
||||
$data['team_home']['conceded']['away']['sum'] +
|
||||
$data['team_away']['scored']['away']['sum'] * $cfHA +
|
||||
$data['team_away']['scored']['home']['sum']
|
||||
) / (
|
||||
$data['team_home']['conceded']['home']['evt'] * $cfHA +
|
||||
$data['team_home']['conceded']['away']['evt'] +
|
||||
$data['team_away']['scored']['home']['evt'] +
|
||||
$data['team_away']['scored']['away']['evt'] * $cfHA
|
||||
), 1);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
@@ -2,48 +2,89 @@
|
||||
|
||||
namespace App\Filament\Widgets\Boxes\Helper;
|
||||
|
||||
use App\Filament\Widgets\Boxes\ExpectationsTeam;
|
||||
|
||||
class ExpectationCollecting
|
||||
{
|
||||
public static function sort(string $similar_past_matches, array &$result, string $type, int $home_id, int $away_id, float $val_home, float $val_away, object $match)
|
||||
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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// 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[$type.'_home_made_total'][] = $val_home;
|
||||
$result[$type.'_away_made_total'][] = $val_away;
|
||||
$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[$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;
|
||||
$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[$type.'_home_made_total'][] = $val_away;
|
||||
$result[$type.'_home_got_total'][] = $val_away;
|
||||
$result[$bettype.'_home_made_total'][] = $val_away;
|
||||
$result[$bettype.'_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;
|
||||
$result[$bettype.'_home_made_total'][] = $val_away;
|
||||
$result[$bettype.'_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;
|
||||
$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[$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;
|
||||
$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[$type.'_away_made_total'][] = $val_home;
|
||||
$result[$type.'_away_got_total'][] = $val_home;
|
||||
$result[$bettype.'_away_made_total'][] = $val_home;
|
||||
$result[$bettype.'_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;
|
||||
$result[$bettype.'_away_made_total'][] = $val_home;
|
||||
$result[$bettype.'_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;
|
||||
$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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user