wip
This commit is contained in:
1 parent
d5713472fc
commit
4b2a1c1b01
6 files changed
+53
-82
No files matched your search
@@ -0,0 +1,8 @@
|
||||
socio proviamo a definire per semplicità i 3 modi di indagine del tool così è più facile anche per noi
|
||||
|
||||
1) SMP
|
||||
|
||||
2) ET (indagine per Events e Team, quella che abbiamo fatto per Lanus e Sarsfield)
|
||||
|
||||
3) PP
|
||||
|
||||
@@ -21,9 +21,43 @@ class ExpectationsBox3
|
||||
return [];
|
||||
}
|
||||
|
||||
// $sum = self::summen($res);
|
||||
|
||||
if ($spm == 'league' or $spm == 'all') {
|
||||
$events = $res->count();
|
||||
$tmp = [];
|
||||
foreach ($bets as $bet) {
|
||||
$tmp[$bet]['home'] = 0;
|
||||
$tmp[$bet]['away'] = 0;
|
||||
}
|
||||
foreach ($res as $val) {
|
||||
// GLS
|
||||
$tmp['gls']['home'] += $val->gls_h;
|
||||
$tmp['gls']['away'] += $val->gls_a;
|
||||
// CRN
|
||||
$tmp['crn']['home'] += $val->crn_h;
|
||||
$tmp['crn']['away'] += $val->crn_a;
|
||||
// FLS
|
||||
$tmp['fls']['home'] += $val->fls_h;
|
||||
$tmp['fls']['away'] += $val->fls_a;
|
||||
// OFS
|
||||
$tmp['ofs']['home'] += $val->ofs_h;
|
||||
$tmp['ofs']['away'] += $val->ofs_a;
|
||||
// CRD
|
||||
$tmp['crd']['home'] += $val->crd_h;
|
||||
$tmp['crd']['away'] += $val->crd_a;
|
||||
// SNT
|
||||
$tmp['snt']['home'] += $val->snt_h;
|
||||
$tmp['snt']['away'] += $val->snt_a;
|
||||
// TSH
|
||||
$tmp['tsh']['home'] += $val->tsh_h;
|
||||
$tmp['tsh']['away'] += $val->tsh_a;
|
||||
}
|
||||
foreach ($bets as $bet) {
|
||||
$expectations[$bet]['home'] = round($tmp[$bet]['home'] / $events, 1);
|
||||
$expectations[$bet]['away'] = round($tmp[$bet]['away'] / $events, 1);
|
||||
}
|
||||
} else {
|
||||
$tmp = self::sceleton();
|
||||
|
||||
foreach ($res as $val) {
|
||||
// home home
|
||||
if ($match->home_id == $val->home_id) {
|
||||
@@ -179,8 +213,10 @@ class ExpectationsBox3
|
||||
$data['away']['events']['away'] * $cfHA
|
||||
), 1);
|
||||
}
|
||||
|
||||
ExpectationsMinMax::calc($expectations, $match);
|
||||
}
|
||||
}
|
||||
|
||||
public static function sceleton()
|
||||
{
|
||||
|
||||
@@ -6,6 +6,9 @@ use App\Models\StatistikoConfig;
|
||||
|
||||
class ExpectationMethodA
|
||||
{
|
||||
/**
|
||||
* keep code to see how to add vars from DB
|
||||
*/
|
||||
public static function calc(array $expectations)
|
||||
{
|
||||
$summen = [];
|
||||
@@ -19,37 +22,5 @@ class ExpectationMethodA
|
||||
$summen[$name]['cnt'] = 1;
|
||||
}
|
||||
}
|
||||
|
||||
$summen2 = [];
|
||||
$bets = ['gls', 'fls', 'ofs', 'crd', 'crn', '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;
|
||||
}
|
||||
}
|
||||
@@ -1,46 +0,0 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Widgets\Boxes\Helper;
|
||||
|
||||
class ExpectationMethodB
|
||||
{
|
||||
public static function calc(array $expectations)
|
||||
{
|
||||
|
||||
// ok in pratica made = scored e got = conceded
|
||||
|
||||
$cfHA = 2;
|
||||
|
||||
$result = [];
|
||||
foreach ($expectations as $bettype => $data) {
|
||||
if ($data['team_home']['scored']['home']['evt'] && $data['team_away']['scored']['home']['evt']) {
|
||||
$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);
|
||||
}
|
||||
if ($data['team_home']['scored']['home']['evt'] && $data['team_away']['scored']['home']['evt']) {
|
||||
$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;
|
||||
}
|
||||
}
|
||||
@@ -16,7 +16,9 @@ class LoadPlayerAverages
|
||||
|
||||
foreach ($players as $val) {
|
||||
|
||||
$res = StatistikoPlayer::whereIn('ss_player_id', $players)->get();
|
||||
$res = StatistikoPlayer::whereIn('ss_player_id', $val->ss_player_id)->get();
|
||||
|
||||
foreach ($res as $val) {
|
||||
|
||||
$ss_player_id = (int) $val->ss_player_id;
|
||||
$activeteam_id = (int) $val->activeteam_id;
|
||||
@@ -89,6 +91,7 @@ class LoadPlayerAverages
|
||||
$arr[$ss_player_id]['total_shots'] += $val->shots_on_target + $val->shots_off_target + $val->shots_blocked;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return $arr;
|
||||
}
|
||||
|
||||
@@ -28,7 +28,6 @@ class LoadEventsQueryAll
|
||||
$handicap_range = [];
|
||||
$total_range = [];
|
||||
if ($similar_past_matches != 'none') {
|
||||
$team_id = 0;
|
||||
$ss_player_id = 0;
|
||||
$exp_handicap = $match->exp_away - $match->exp_home;
|
||||
$exp_total = $match->exp_away + $match->exp_home;
|
||||
|
||||
Reference in new issue
Block a user