wip fix error box 3
This commit is contained in:
1 parent
2728944c39
commit
e52722d3e1
9 files changed
+455
-119
No files matched your search
@@ -0,0 +1,65 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Widgets\Boxes;
|
||||
|
||||
use App\Filament\Widgets\Charts\LoadEvents\LoadEventsQueryTP;
|
||||
use App\Utilities\Round;
|
||||
|
||||
class Expectation1X2
|
||||
{
|
||||
public static function load(array &$expectations, array $filter, object $match)
|
||||
{
|
||||
$team_id = (int) $filter['team_id'] ?? 0;
|
||||
$team_position = $filter['team_position'];
|
||||
|
||||
$res_tp = LoadEventsQueryTP::load($filter, $match);
|
||||
|
||||
$count_tp = $res_tp->count();
|
||||
$expectations['count_events'] = $count_tp;
|
||||
|
||||
$expectations += ['win_count' => 0, 'draw_count' => 0, 'lost_count' => 0];
|
||||
foreach ($res_tp as $value) {
|
||||
if ($team_id && $team_position == 'home') {
|
||||
switch ($value['result_code']) {
|
||||
case '1':
|
||||
$expectations['win_count']++;
|
||||
break;
|
||||
case 'X':
|
||||
$expectations['draw_count']++;
|
||||
break;
|
||||
case '2':
|
||||
$expectations['lost_count']++;
|
||||
break;
|
||||
}
|
||||
} elseif ($team_id && $team_position == 'away') {
|
||||
switch ($value['result_code']) {
|
||||
case '1':
|
||||
$expectations['win_count']++;
|
||||
break;
|
||||
case 'X':
|
||||
$expectations['draw_count']++;
|
||||
break;
|
||||
case '2':
|
||||
$expectations['lost_count']++;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch ($value['result_code']) {
|
||||
case '1':
|
||||
$expectations['win_count']++;
|
||||
break;
|
||||
case 'X':
|
||||
$expectations['draw_count']++;
|
||||
break;
|
||||
case '2':
|
||||
$expectations['lost_count']++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$expectations['win_odd'] = $expectations['win_count'] ? number_format(Round::odd($count_tp / $expectations['win_count']), 2) : 0;
|
||||
$expectations['draw_odd'] = $expectations['draw_count'] ? number_format(Round::odd($count_tp / $expectations['draw_count']), 2) : 0;
|
||||
$expectations['lost_odd'] = $expectations['lost_count'] ? number_format(Round::odd($count_tp / $expectations['lost_count']), 2) : 0;
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user