TP ma mostra sempre il valore come se TP = ALL
This commit is contained in:
1 parent
d0e2f32501
commit
4f7f9f28f1
3 files changed
+36
-6
No files matched your search
@@ -4,6 +4,7 @@ namespace App\Filament\Widgets\Boxes;
|
||||
|
||||
use App\Filament\Widgets\Boxes\Helper\ExpectationCalculation;
|
||||
use App\Filament\Widgets\Boxes\Helper\ExpectationCollecting;
|
||||
use App\Filament\Widgets\Boxes\Helper\ExpectationCounting;
|
||||
use App\Filament\Widgets\Charts\LoadEvents\LoadEventsQueryAll;
|
||||
use App\Utilities\Round;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
@@ -31,10 +32,14 @@ class ExpectationsTeam
|
||||
|
||||
$res = LoadEventsQueryAll::load($filter, $match);
|
||||
|
||||
$count_events = $res->count();
|
||||
$count_events = ExpectationCounting::count($team_position, $team_id, $res);
|
||||
|
||||
// Log::debug('count_events ' . $count_events);
|
||||
|
||||
if (! $res) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$tmp = [];
|
||||
foreach ($res as $value) {
|
||||
ExpectationCollecting::sort($similar_past_matches, $tmp, 'gls', $value->home_id, $value->away_id, $value->gls_h, $value->gls_a, $match);
|
||||
@@ -46,7 +51,6 @@ class ExpectationsTeam
|
||||
ExpectationCollecting::sort($similar_past_matches, $tmp, 'crn', $value->home_id, $value->away_id, $value->crn_h, $value->crn_a, $match);
|
||||
}
|
||||
|
||||
// Log::debug('expectations '.$count_events, $tmp);
|
||||
|
||||
$expectations = ExpectationCalculation::calc($tmp);
|
||||
$expectations['gls']['name'] = 'Goals';
|
||||
@@ -58,8 +62,6 @@ class ExpectationsTeam
|
||||
$expectations['home'] = $home_team;
|
||||
$expectations['away'] = $away_team;
|
||||
|
||||
// Log::debug('expectations '.$count_events, $expectations);
|
||||
|
||||
$expectations += ['win_count' => 0, 'draw_count' => 0, 'lost_count' => 0];
|
||||
foreach ($res as $value) {
|
||||
if ($team_id && $team_position == 'home') {
|
||||
@@ -74,7 +76,6 @@ class ExpectationsTeam
|
||||
$expectations['lost_count']++;
|
||||
break;
|
||||
}
|
||||
|
||||
} elseif ($team_id && $team_position == 'away') {
|
||||
switch ($value['result_code']) {
|
||||
case '1':
|
||||
@@ -87,7 +88,6 @@ class ExpectationsTeam
|
||||
$expectations['lost_count']++;
|
||||
break;
|
||||
}
|
||||
|
||||
} else {
|
||||
switch ($value['result_code']) {
|
||||
case '1':
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
namespace App\Filament\Widgets\Boxes\Helper;
|
||||
|
||||
class ExpectationCounting
|
||||
{
|
||||
public static function count(string $team_position, int $team_id, object $res)
|
||||
{
|
||||
$count = 0;
|
||||
foreach ($res as $value) {
|
||||
switch ($team_position) {
|
||||
case 'home':
|
||||
if ($value->home_id == $team_id)
|
||||
$count++;
|
||||
break;
|
||||
case 'away':
|
||||
if ($value->away_id == $team_id)
|
||||
$count++;
|
||||
break;
|
||||
|
||||
default:
|
||||
$count++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return $count;
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,7 @@ class LoadEventsBoxes
|
||||
}
|
||||
|
||||
$expectations = [];
|
||||
|
||||
ExpectationsTeam::load($expectations, $filter, $match);
|
||||
|
||||
if ($team_id == $match->home_id) {
|
||||
|
||||
Reference in new issue
Block a user