wip order classes

This commit is contained in:
salam committed 2026-09-25 10:18:20 +02:00
1 parent fe4fa6e9cf
commit 7bf4258c4a
29 files changed
+140 -124

No files matched your search

@@ -1,8 +1,9 @@
<?php <?php
namespace App\Filament\Widgets\Data\LoadEvents; namespace App\Filament\Widgets\Boxes;
use App\Filament\Pages\Selections\Helper\GetSeason; use App\Filament\Pages\Selections\Helper\GetSeason;
use App\Filament\Widgets\Boxes\Helper\ExpectationAverage;
use App\Models\StatistikoEvent; use App\Models\StatistikoEvent;
class AverageLeagueSeason class AverageLeagueSeason
@@ -1,8 +1,9 @@
<?php <?php
namespace App\Filament\Widgets\Data\LoadEvents; namespace App\Filament\Widgets\Boxes;
use App\Filament\Pages\Selections\Helper\GetSeason; use App\Filament\Pages\Selections\Helper\GetSeason;
use App\Filament\Widgets\Boxes\Helper\ExpectationAverage;
use App\Models\StatistikoEvent; use App\Models\StatistikoEvent;
class AverageTeam class AverageTeam
@@ -1,8 +1,9 @@
<?php <?php
namespace App\Filament\Widgets\Data\LoadEvents; namespace App\Filament\Widgets\Boxes;
use App\Filament\Pages\Selections\Helper\GetSeason; use App\Filament\Pages\Selections\Helper\GetSeason;
use App\Filament\Widgets\Boxes\Helper\ExpectationAverage;
use App\Models\StatistikoEvent; use App\Models\StatistikoEvent;
class AverageTeamSeason class AverageTeamSeason
@@ -1,42 +1,25 @@
<?php <?php
namespace App\Filament\Widgets\Data; namespace App\Filament\Widgets\Boxes;
use App\Filament\Widgets\Data\LoadEvents\AverageLeagueSeason; use App\Filament\Widgets\Boxes\Helper\ExpectationCalculation;
use App\Filament\Widgets\Data\LoadEvents\AverageTeam; use App\Filament\Widgets\Boxes\Helper\ExpectationCollecting;
use App\Filament\Widgets\Data\LoadEvents\AverageTeamSeason; use App\Filament\Widgets\Charts\LoadEvents\LoadEventsQueryAll;
use App\Filament\Widgets\Data\LoadEvents\ExpectationCalculation;
use App\Filament\Widgets\Data\LoadEvents\ExpectationCollecting;
use App\Filament\Widgets\Data\LoadEvents\LoadEventsQueryAll;
use App\Models\StatisticFixtures;
use App\Utilities\Round; use App\Utilities\Round;
class LoadEventsBoxes class ExpectationsTeam
{ {
public static function load(array $filter, bool $hasdots) public static function load(array &$expectations, array $filter, object $match)
{ {
/**
* STATTISTIC DATA
*/
$league_id = (int) $filter['league_id'] ?? 0; $league_id = (int) $filter['league_id'] ?? 0;
$match_id = (int) $filter['match_id'] ?? 0; $match_id = (int) $filter['match_id'] ?? 0;
$team_id = (int) $filter['team_id'] ?? 0; $team_id = (int) $filter['team_id'] ?? 0;
$team_position = $filter['team_position']; $team_position = $filter['team_position'];
$similar_past_matches = $filter['similar_past_matches']; $similar_past_matches = $filter['similar_past_matches'];
if (! $league_id) {
return [];
}
if (! $match_id) {
return [];
}
if (! $team_id) {
return [];
}
$match = StatisticFixtures::with('home')->with('away')->where('id', (int) $match_id)->first();
if (! $match) {
return [];
}
if ($similar_past_matches != 'none') { if ($similar_past_matches != 'none') {
$team_id = 0; $team_id = 0;
$team_position = ''; $team_position = '';
@@ -47,9 +30,6 @@ class LoadEventsBoxes
$away_team = 'Against'; $away_team = 'Against';
} }
/**
* STATTISTIC DATA
*/
$res = LoadEventsQueryAll::load($filter, $match); $res = LoadEventsQueryAll::load($filter, $match);
if (! $res) { if (! $res) {
return []; return [];
@@ -126,22 +106,5 @@ class LoadEventsBoxes
$expectations['draw_odd'] = $expectations['draw_count'] ? number_format(Round::odd($count_events / $expectations['draw_count']), 2) : 0; $expectations['draw_odd'] = $expectations['draw_count'] ? number_format(Round::odd($count_events / $expectations['draw_count']), 2) : 0;
$expectations['lost_odd'] = $expectations['lost_count'] ? number_format(Round::odd($count_events / $expectations['lost_count']), 2) : 0; $expectations['lost_odd'] = $expectations['lost_count'] ? number_format(Round::odd($count_events / $expectations['lost_count']), 2) : 0;
$expectations['count_events'] = $count_events; $expectations['count_events'] = $count_events;
if ($team_id == $match->home_id) {
$expectations['active_team'] = $match->home->ss_team_name;
} else {
$expectations['active_team'] = $match->away->ss_team_name;
}
/**
* LEAGUE AVERAGES
*/
if ($team_id != 0 && $similar_past_matches == 'none') {
AverageTeam::load($expectations, $filter);
AverageTeamSeason::load($expectations, $filter);
AverageLeagueSeason::load($expectations, $filter);
}
return $expectations;
} }
} }
@@ -1,6 +1,6 @@
<?php <?php
namespace App\Filament\Widgets\Data\LoadEvents; namespace App\Filament\Widgets\Boxes\Helper;
class ExpectationAverage class ExpectationAverage
{ {
@@ -1,6 +1,6 @@
<?php <?php
namespace App\Filament\Widgets\Data\LoadEvents; namespace App\Filament\Widgets\Boxes\Helper;
use App\Models\StatistikoConfig; use App\Models\StatistikoConfig;
@@ -1,6 +1,6 @@
<?php <?php
namespace App\Filament\Widgets\Data\LoadEvents; namespace App\Filament\Widgets\Boxes\Helper;
class ExpectationCollecting class ExpectationCollecting
{ {
@@ -0,0 +1,53 @@
<?php
namespace App\Filament\Widgets\Boxes;
use App\Models\StatisticFixtures;
class LoadEventsBoxes
{
public static function load(array $filter, bool $hasdots)
{
$league_id = (int) $filter['league_id'] ?? 0;
$match_id = (int) $filter['match_id'] ?? 0;
$team_id = (int) $filter['team_id'] ?? 0;
$team_position = $filter['team_position'];
$similar_past_matches = $filter['similar_past_matches'];
if (! $league_id) {
return [];
}
if (! $match_id) {
return [];
}
if (! $team_id) {
return [];
}
$match = StatisticFixtures::with('home')->with('away')->where('id', (int) $match_id)->first();
if (! $match) {
return [];
}
$expectations = [];
ExpectationsTeam::load($expectations, $filter, $match);
if ($team_id == $match->home_id) {
$expectations['active_team'] = $match->home->ss_team_name;
} else {
$expectations['active_team'] = $match->away->ss_team_name;
}
/**
* LEAGUE AVERAGES
*/
if ($team_id != 0 && $similar_past_matches == 'none') {
AverageTeam::load($expectations, $filter);
AverageTeamSeason::load($expectations, $filter);
AverageLeagueSeason::load($expectations, $filter);
}
return $expectations;
}
}
+1 -1
View File
@@ -2,7 +2,7 @@
namespace App\Filament\Widgets; namespace App\Filament\Widgets;
use App\Filament\Widgets\Data\LoadEventsBoxes; use App\Filament\Widgets\Boxes\LoadEventsBoxes;
use Filament\Widgets\Concerns\InteractsWithPageFilters; use Filament\Widgets\Concerns\InteractsWithPageFilters;
use Filament\Widgets\StatsOverviewWidget; use Filament\Widgets\StatsOverviewWidget;
use Filament\Widgets\StatsOverviewWidget\Stat; use Filament\Widgets\StatsOverviewWidget\Stat;
+2 -2
View File
@@ -2,8 +2,8 @@
namespace App\Filament\Widgets; namespace App\Filament\Widgets;
use App\Filament\Widgets\Data\HelperStatisticType; use App\Filament\Widgets\Charts\HelperStatisticType;
use App\Filament\Widgets\Data\LoadEvents; use App\Filament\Widgets\Charts\LoadEvents;
use App\Utilities\Round; use App\Utilities\Round;
use Filament\Widgets\Concerns\InteractsWithPageFilters; use Filament\Widgets\Concerns\InteractsWithPageFilters;
use Filament\Widgets\StatsOverviewWidget; use Filament\Widgets\StatsOverviewWidget;
+2 -2
View File
@@ -2,8 +2,8 @@
namespace App\Filament\Widgets; namespace App\Filament\Widgets;
use App\Filament\Widgets\Data\HelperStatisticType; use App\Filament\Widgets\Charts\HelperStatisticType;
use App\Filament\Widgets\Data\LoadEvents; use App\Filament\Widgets\Charts\LoadEvents;
use Filament\Support\RawJs; use Filament\Support\RawJs;
use Filament\Widgets\ChartWidget; use Filament\Widgets\ChartWidget;
use Illuminate\Support\HtmlString; use Illuminate\Support\HtmlString;
+4 -4
View File
@@ -2,9 +2,9 @@
namespace App\Filament\Widgets; namespace App\Filament\Widgets;
use App\Filament\Widgets\Data\HelperMoveingAverage; use App\Filament\Widgets\Charts\HelperMoveingAverage;
use App\Filament\Widgets\Data\HelperStatisticType; use App\Filament\Widgets\Charts\HelperStatisticType;
use App\Filament\Widgets\Data\LoadEvents; use App\Filament\Widgets\Charts\LoadEvents;
use Filament\Support\RawJs; use Filament\Support\RawJs;
use Filament\Widgets\ChartWidget; use Filament\Widgets\ChartWidget;
use Illuminate\Support\HtmlString; use Illuminate\Support\HtmlString;
@@ -27,7 +27,7 @@ class ChartEventMoAv extends ChartWidget
<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" fill="currentColor" viewBox="0 0 256 256"><path d="M232,64H208V48a8,8,0,0,0-8-8H56a8,8,0,0,0-8,8V64H24A16,16,0,0,0,8,80V96a40,40,0,0,0,40,40h3.65A80.13,80.13,0,0,0,120,191.61V216H96a8,8,0,0,0,0,16h64a8,8,0,0,0,0-16H136V191.58c31.94-3.23,58.44-25.64,68.08-55.58H208a40,40,0,0,0,40-40V80A16,16,0,0,0,232,64ZM48,120A24,24,0,0,1,24,96V80H48v32q0,4,.39,8Zm144-8.9c0,35.52-29,64.64-64,64.9a64,64,0,0,1-64-64V56H192ZM232,96a24,24,0,0,1-24,24h-.5a81.81,81.81,0,0,0,.5-8.9V80h24Z"></path></svg> <svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" fill="currentColor" viewBox="0 0 256 256"><path d="M232,64H208V48a8,8,0,0,0-8-8H56a8,8,0,0,0-8,8V64H24A16,16,0,0,0,8,80V96a40,40,0,0,0,40,40h3.65A80.13,80.13,0,0,0,120,191.61V216H96a8,8,0,0,0,0,16h64a8,8,0,0,0,0-16H136V191.58c31.94-3.23,58.44-25.64,68.08-55.58H208a40,40,0,0,0,40-40V80A16,16,0,0,0,232,64ZM48,120A24,24,0,0,1,24,96V80H48v32q0,4,.39,8Zm144-8.9c0,35.52-29,64.64-64,64.9a64,64,0,0,1-64-64V56H192ZM232,96a24,24,0,0,1-24,24h-.5a81.81,81.81,0,0,0,.5-8.9V80h24Z"></path></svg>
Events Events
</span> </span>
<span>' . $this->type . ' Moving Average</span> <span>'.$this->type.' Moving Average</span>
</span> </span>
'); ');
} }
+2 -2
View File
@@ -2,7 +2,7 @@
namespace App\Filament\Widgets; namespace App\Filament\Widgets;
use App\Filament\Widgets\Data\LoadPerformance; use App\Filament\Widgets\Charts\LoadPerformance;
use Filament\Support\RawJs; use Filament\Support\RawJs;
use Filament\Widgets\ChartWidget; use Filament\Widgets\ChartWidget;
use Illuminate\Support\HtmlString; use Illuminate\Support\HtmlString;
@@ -25,7 +25,7 @@ class ChartEventPerf extends ChartWidget
<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" fill="currentColor" viewBox="0 0 256 256"><path d="M232,64H208V48a8,8,0,0,0-8-8H56a8,8,0,0,0-8,8V64H24A16,16,0,0,0,8,80V96a40,40,0,0,0,40,40h3.65A80.13,80.13,0,0,0,120,191.61V216H96a8,8,0,0,0,0,16h64a8,8,0,0,0,0-16H136V191.58c31.94-3.23,58.44-25.64,68.08-55.58H208a40,40,0,0,0,40-40V80A16,16,0,0,0,232,64ZM48,120A24,24,0,0,1,24,96V80H48v32q0,4,.39,8Zm144-8.9c0,35.52-29,64.64-64,64.9a64,64,0,0,1-64-64V56H192ZM232,96a24,24,0,0,1-24,24h-.5a81.81,81.81,0,0,0,.5-8.9V80h24Z"></path></svg> <svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" fill="currentColor" viewBox="0 0 256 256"><path d="M232,64H208V48a8,8,0,0,0-8-8H56a8,8,0,0,0-8,8V64H24A16,16,0,0,0,8,80V96a40,40,0,0,0,40,40h3.65A80.13,80.13,0,0,0,120,191.61V216H96a8,8,0,0,0,0,16h64a8,8,0,0,0,0-16H136V191.58c31.94-3.23,58.44-25.64,68.08-55.58H208a40,40,0,0,0,40-40V80A16,16,0,0,0,232,64ZM48,120A24,24,0,0,1,24,96V80H48v32q0,4,.39,8Zm144-8.9c0,35.52-29,64.64-64,64.9a64,64,0,0,1-64-64V56H192ZM232,96a24,24,0,0,1-24,24h-.5a81.81,81.81,0,0,0,.5-8.9V80h24Z"></path></svg>
Events Performance Events Performance
</span> </span>
<span>' . $this->type . '</span> <span>'.$this->type.'</span>
</span> </span>
'); ');
} }
+3 -3
View File
@@ -2,8 +2,8 @@
namespace App\Filament\Widgets; namespace App\Filament\Widgets;
use App\Filament\Widgets\Data\HelperMoveingAveragePerformens; use App\Filament\Widgets\Charts\HelperMoveingAveragePerformens;
use App\Filament\Widgets\Data\LoadPerformance; use App\Filament\Widgets\Charts\LoadPerformance;
use Filament\Support\RawJs; use Filament\Support\RawJs;
use Filament\Widgets\ChartWidget; use Filament\Widgets\ChartWidget;
use Illuminate\Support\HtmlString; use Illuminate\Support\HtmlString;
@@ -26,7 +26,7 @@ class ChartEventPerfMoAv extends ChartWidget
<svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" fill="currentColor" viewBox="0 0 256 256"><path d="M232,64H208V48a8,8,0,0,0-8-8H56a8,8,0,0,0-8,8V64H24A16,16,0,0,0,8,80V96a40,40,0,0,0,40,40h3.65A80.13,80.13,0,0,0,120,191.61V216H96a8,8,0,0,0,0,16h64a8,8,0,0,0,0-16H136V191.58c31.94-3.23,58.44-25.64,68.08-55.58H208a40,40,0,0,0,40-40V80A16,16,0,0,0,232,64ZM48,120A24,24,0,0,1,24,96V80H48v32q0,4,.39,8Zm144-8.9c0,35.52-29,64.64-64,64.9a64,64,0,0,1-64-64V56H192ZM232,96a24,24,0,0,1-24,24h-.5a81.81,81.81,0,0,0,.5-8.9V80h24Z"></path></svg> <svg xmlns="http://www.w3.org/2000/svg" width="22" height="22" fill="currentColor" viewBox="0 0 256 256"><path d="M232,64H208V48a8,8,0,0,0-8-8H56a8,8,0,0,0-8,8V64H24A16,16,0,0,0,8,80V96a40,40,0,0,0,40,40h3.65A80.13,80.13,0,0,0,120,191.61V216H96a8,8,0,0,0,0,16h64a8,8,0,0,0,0-16H136V191.58c31.94-3.23,58.44-25.64,68.08-55.58H208a40,40,0,0,0,40-40V80A16,16,0,0,0,232,64ZM48,120A24,24,0,0,1,24,96V80H48v32q0,4,.39,8Zm144-8.9c0,35.52-29,64.64-64,64.9a64,64,0,0,1-64-64V56H192ZM232,96a24,24,0,0,1-24,24h-.5a81.81,81.81,0,0,0,.5-8.9V80h24Z"></path></svg>
Events Performance Events Performance
</span> </span>
<span>' . $this->type . 'Moving Average</span> <span>'.$this->type.'Moving Average</span>
</span> </span>
'); ');
} }
+2 -2
View File
@@ -2,8 +2,8 @@
namespace App\Filament\Widgets; namespace App\Filament\Widgets;
use App\Filament\Widgets\Data\HelperStatisticType; use App\Filament\Widgets\Charts\HelperStatisticType;
use App\Filament\Widgets\Data\LoadPlayerWidgets; use App\Filament\Widgets\Charts\LoadPlayerWidgets;
use Filament\Support\RawJs; use Filament\Support\RawJs;
use Filament\Widgets\ChartWidget; use Filament\Widgets\ChartWidget;
use Illuminate\Support\HtmlString; use Illuminate\Support\HtmlString;
+3 -3
View File
@@ -2,9 +2,9 @@
namespace App\Filament\Widgets; namespace App\Filament\Widgets;
use App\Filament\Widgets\Data\HelperMoveingAverage; use App\Filament\Widgets\Charts\HelperMoveingAverage;
use App\Filament\Widgets\Data\HelperStatisticType; use App\Filament\Widgets\Charts\HelperStatisticType;
use App\Filament\Widgets\Data\LoadPlayerWidgets; use App\Filament\Widgets\Charts\LoadPlayerWidgets;
use Filament\Support\RawJs; use Filament\Support\RawJs;
use Filament\Widgets\ChartWidget; use Filament\Widgets\ChartWidget;
use Illuminate\Support\HtmlString; use Illuminate\Support\HtmlString;
+2 -2
View File
@@ -2,7 +2,7 @@
namespace App\Filament\Widgets; namespace App\Filament\Widgets;
use App\Filament\Widgets\Data\LoadPlayerPerformance; use App\Filament\Widgets\Charts\LoadPlayerPerformance;
use Filament\Support\RawJs; use Filament\Support\RawJs;
use Filament\Widgets\ChartWidget; use Filament\Widgets\ChartWidget;
use Illuminate\Support\HtmlString; use Illuminate\Support\HtmlString;
@@ -37,7 +37,7 @@ class ChartPlayerPerf extends ChartWidget
c0.211,0.1782,0.5264,0.1516,0.7046-0.0593C13.0037,6.5523,13.0018,6.2761,12.84,6.09z"></path> c0.211,0.1782,0.5264,0.1516,0.7046-0.0593C13.0037,6.5523,13.0018,6.2761,12.84,6.09z"></path>
</g> </g>
</svg> </svg>
' . $this->player . ' '.$this->player.'
</span> </span>
<span>Performance</span> <span>Performance</span>
</span> </span>
+3 -3
View File
@@ -2,8 +2,8 @@
namespace App\Filament\Widgets; namespace App\Filament\Widgets;
use App\Filament\Widgets\Data\HelperMoveingAverage; use App\Filament\Widgets\Charts\HelperMoveingAverage;
use App\Filament\Widgets\Data\LoadPlayerPerformance; use App\Filament\Widgets\Charts\LoadPlayerPerformance;
use Filament\Support\RawJs; use Filament\Support\RawJs;
use Filament\Widgets\ChartWidget; use Filament\Widgets\ChartWidget;
use Illuminate\Support\HtmlString; use Illuminate\Support\HtmlString;
@@ -38,7 +38,7 @@ class ChartPlayerPerfMoAv extends ChartWidget
c0.211,0.1782,0.5264,0.1516,0.7046-0.0593C13.0037,6.5523,13.0018,6.2761,12.84,6.09z"></path> c0.211,0.1782,0.5264,0.1516,0.7046-0.0593C13.0037,6.5523,13.0018,6.2761,12.84,6.09z"></path>
</g> </g>
</svg> </svg>
' . $this->player . ' '.$this->player.'
</span> </span>
<span>Performance Moving Average</span> <span>Performance Moving Average</span>
</span> </span>
@@ -1,6 +1,6 @@
<?php <?php
namespace App\Filament\Widgets\Data; namespace App\Filament\Widgets\Charts;
class HelperMoveingAverage class HelperMoveingAverage
{ {
@@ -19,9 +19,9 @@ class HelperMoveingAverage
$last = count($arr); $last = count($arr);
foreach ($arr as $key => $value) { foreach ($arr as $key => $value) {
if ($key == 1 && $last > 2) { if ($key == 1 && $last > 2) {
$new[] = round(((float) $arr[0] + (float) $value + (float) $arr[2]) / 3, 1); $new[] = round(((float) $arr[0] + (float) $value + (float) $arr[2]) / 3, 1);
} elseif ($key > 1 && $key < $last - 1) { } elseif ($key > 1 && $key < $last - 1) {
$new[] = round(((float) $arr[$key - 1] + (float) $value + (float) $arr[$key + 1]) / 3, 1); $new[] = round(((float) $arr[$key - 1] + (float) $value + (float) $arr[$key + 1]) / 3, 1);
} }
} }
$data['datasets'][$k]['data'] = $new; $data['datasets'][$k]['data'] = $new;
@@ -1,6 +1,6 @@
<?php <?php
namespace App\Filament\Widgets\Data; namespace App\Filament\Widgets\Charts;
class HelperMoveingAveragePerformens class HelperMoveingAveragePerformens
{ {
@@ -1,6 +1,6 @@
<?php <?php
namespace App\Filament\Widgets\Data; namespace App\Filament\Widgets\Charts;
class HelperStatisticType class HelperStatisticType
{ {
@@ -1,10 +1,10 @@
<?php <?php
namespace App\Filament\Widgets\Data; namespace App\Filament\Widgets\Charts;
use App\Filament\Widgets\Data\LoadEvents\LoadEventsAverages; use App\Filament\Widgets\Charts\LoadEvents\LoadEventsAverages;
use App\Filament\Widgets\Data\LoadEvents\LoadEventsQuery; use App\Filament\Widgets\Charts\LoadEvents\LoadEventsQuery;
use App\Filament\Widgets\Data\LoadEvents\LoadExpectations; use App\Filament\Widgets\Charts\LoadEvents\LoadExpectations;
use App\Models\StatisticFixtures; use App\Models\StatisticFixtures;
use Illuminate\Support\Carbon; use Illuminate\Support\Carbon;
@@ -1,10 +1,8 @@
<?php <?php
namespace App\Filament\Widgets\Data\LoadEvents; namespace App\Filament\Widgets\Charts\LoadEvents;
use App\Models\SofaScoreTournament;
use App\Models\StatistikoEvent; use App\Models\StatistikoEvent;
use App\Models\Country;
class LoadEventsAverages class LoadEventsAverages
{ {
@@ -19,9 +17,9 @@ class LoadEventsAverages
$start = $filter['start_date'] ?? 0; $start = $filter['start_date'] ?? 0;
$end = $filter['end_date'] ?? 0; $end = $filter['end_date'] ?? 0;
if ($season_or_date != 'season') if ($season_or_date != 'season') {
$season = 0; $season = 0;
else { } else {
$end = 0; $end = 0;
$start = 0; $start = 0;
} }
@@ -46,11 +44,11 @@ class LoadEventsAverages
$league_home = []; $league_home = [];
$league_away = []; $league_away = [];
// 1) la media dei falli di tutte le partite giocate dal Flamengo // 1) la media dei falli di tutte le partite giocate dal Flamengo
// (esempio, giocate 6 partite con falli 17-11-15-14-15-12, la media è 14) // (esempio, giocate 6 partite con falli 17-11-15-14-15-12, la media è 14)
// 2) la media dei falli di tutte le partite giocate nel campionato Brasiliano // 2) la media dei falli di tutte le partite giocate nel campionato Brasiliano
// (esempio 6 giornate giocate = 60 partite quindi 120 squadre, quindi 120 dati tipo 17-12-12-15-8-15-13-21-..., // (esempio 6 giornate giocate = 60 partite quindi 120 squadre, quindi 120 dati tipo 17-12-12-15-8-15-13-21-...,
// quindi la media di questi 120 dati) // quindi la media di questi 120 dati)
foreach ($res as $value) { foreach ($res as $value) {
@@ -85,7 +83,7 @@ class LoadEventsAverages
break; break;
} }
if ((!$team_position || $team_position == 'all') && ($team_id == $value['home_id'] or $team_id == $value['away_id'])) { if ((! $team_position || $team_position == 'all') && ($team_id == $value['home_id'] or $team_id == $value['away_id'])) {
switch ($statistic_type) { switch ($statistic_type) {
case 'gls': case 'gls':
if ($team_id == $value['home_id']) { if ($team_id == $value['home_id']) {
@@ -151,7 +149,7 @@ class LoadEventsAverages
} }
break; break;
} }
} else if ($team_position == 'home' && $team_id == $value['home_id']) { } elseif ($team_position == 'home' && $team_id == $value['home_id']) {
switch ($statistic_type) { switch ($statistic_type) {
case 'gls': case 'gls':
$team_home[] = (int) $value['gls_h']; $team_home[] = (int) $value['gls_h'];
@@ -182,7 +180,7 @@ class LoadEventsAverages
$team_away[] = (int) $value['tsh_a']; $team_away[] = (int) $value['tsh_a'];
break; break;
} }
} else if ($team_position == 'away' && $team_id == $value['away_id']) { } elseif ($team_position == 'away' && $team_id == $value['away_id']) {
switch ($statistic_type) { switch ($statistic_type) {
case 'gls': case 'gls':
$team_home[] = (int) $value['gls_a']; $team_home[] = (int) $value['gls_a'];
@@ -1,6 +1,6 @@
<?php <?php
namespace App\Filament\Widgets\Data\LoadEvents; namespace App\Filament\Widgets\Charts\LoadEvents;
use App\Filament\Pages\Selections\Helper\GetSeason; use App\Filament\Pages\Selections\Helper\GetSeason;
use App\Models\StatistikoEvent; use App\Models\StatistikoEvent;
@@ -1,6 +1,6 @@
<?php <?php
namespace App\Filament\Widgets\Data\LoadEvents; namespace App\Filament\Widgets\Charts\LoadEvents;
use App\Filament\Pages\Selections\Helper\GetSeason; use App\Filament\Pages\Selections\Helper\GetSeason;
use App\Models\StatistikoEvent; use App\Models\StatistikoEvent;
@@ -1,6 +1,6 @@
<?php <?php
namespace App\Filament\Widgets\Data\LoadEvents; namespace App\Filament\Widgets\Charts\LoadEvents;
use App\Models\StatistikoConfig; use App\Models\StatistikoConfig;
@@ -1,11 +1,11 @@
<?php <?php
namespace App\Filament\Widgets\Data; namespace App\Filament\Widgets\Charts;
use Illuminate\Support\Carbon; use App\Models\StatisticFixtures;
use App\Models\StatistikoEvent; use App\Models\StatistikoEvent;
use App\Models\StatistikoPlayer; use App\Models\StatistikoPlayer;
use App\Models\StatisticFixtures; use Illuminate\Support\Carbon;
class LoadPerformance class LoadPerformance
{ {
@@ -62,15 +62,15 @@ class LoadPerformance
if ($val->home_id == $home_id) { if ($val->home_id == $home_id) {
$labels[] = round($val->starttime->diffInDays(Carbon::now())); $labels[] = round($val->starttime->diffInDays(Carbon::now()));
$date_home[] = $val['starttime']->format('Y-m-d H:i'); $date_home[] = $val['starttime']->format('Y-m-d H:i');
$results_home[] = $val['gls_h'] . ' : ' . $val['gls_a']; $results_home[] = $val['gls_h'].' : '.$val['gls_a'];
$events_home[] = $val->home->ss_team_name . ' vs ' . $val->away->ss_team_name; $events_home[] = $val->home->ss_team_name.' vs '.$val->away->ss_team_name;
$home_matches[] = $val->match_id; $home_matches[] = $val->match_id;
} }
if ($val->away_id == $away_id) { if ($val->away_id == $away_id) {
$labels[] = round($val->starttime->diffInDays(Carbon::now())); $labels[] = round($val->starttime->diffInDays(Carbon::now()));
$date_away[] = $val['starttime']->format('Y-m-d H:i'); $date_away[] = $val['starttime']->format('Y-m-d H:i');
$results_away[] = $val['gls_h'] . ' : ' . $val['gls_a']; $results_away[] = $val['gls_h'].' : '.$val['gls_a'];
$events_away[] = $val->home->ss_team_name . ' vs ' . $val->away->ss_team_name; $events_away[] = $val->home->ss_team_name.' vs '.$val->away->ss_team_name;
$away_matches[] = $val->match_id; $away_matches[] = $val->match_id;
} }
break; break;
@@ -78,15 +78,15 @@ class LoadPerformance
if ($val->away_id == $home_id) { if ($val->away_id == $home_id) {
$labels[] = round($val->starttime->diffInDays(Carbon::now())); $labels[] = round($val->starttime->diffInDays(Carbon::now()));
$date_home[] = $val['starttime']->format('Y-m-d H:i'); $date_home[] = $val['starttime']->format('Y-m-d H:i');
$results_home[] = $val['gls_h'] . ' : ' . $val['gls_a']; $results_home[] = $val['gls_h'].' : '.$val['gls_a'];
$events_home[] = $val->home->name . ' vs ' . $val->away->name; $events_home[] = $val->home->name.' vs '.$val->away->name;
$home_matches[] = $val->match_id; $home_matches[] = $val->match_id;
} }
if ($val->home_id == $away_id) { if ($val->home_id == $away_id) {
$labels[] = round($val->starttime->diffInDays(Carbon::now())); $labels[] = round($val->starttime->diffInDays(Carbon::now()));
$date_away[] = $val['starttime']->format('Y-m-d H:i'); $date_away[] = $val['starttime']->format('Y-m-d H:i');
$results_away[] = $val['gls_h'] . ' : ' . $val['gls_a']; $results_away[] = $val['gls_h'].' : '.$val['gls_a'];
$events_away[] = $val->home->ss_team_name . ' vs ' . $val->away->ss_team_name; $events_away[] = $val->home->ss_team_name.' vs '.$val->away->ss_team_name;
$away_matches[] = $val->match_id; $away_matches[] = $val->match_id;
} }
break; break;
@@ -94,15 +94,15 @@ class LoadPerformance
if ($val->home_id == $home_id or $val->away_id == $home_id) { if ($val->home_id == $home_id or $val->away_id == $home_id) {
$labels[] = round($val->starttime->diffInDays(Carbon::now())); $labels[] = round($val->starttime->diffInDays(Carbon::now()));
$date_home[] = $val['starttime']->format('Y-m-d H:i'); $date_home[] = $val['starttime']->format('Y-m-d H:i');
$results_home[] = $val['gls_h'] . ' : ' . $val['gls_a']; $results_home[] = $val['gls_h'].' : '.$val['gls_a'];
$events_home[] = $val->home->ss_team_name . ' vs ' . $val->away->ss_team_name; $events_home[] = $val->home->ss_team_name.' vs '.$val->away->ss_team_name;
$home_matches[] = $val->match_id; $home_matches[] = $val->match_id;
} }
if ($val->home_id == $away_id or $val->away_id == $away_id) { if ($val->home_id == $away_id or $val->away_id == $away_id) {
$labels[] = round($val->starttime->diffInDays(Carbon::now())); $labels[] = round($val->starttime->diffInDays(Carbon::now()));
$date_away[] = $val['starttime']->format('Y-m-d H:i'); $date_away[] = $val['starttime']->format('Y-m-d H:i');
$results_away[] = $val['gls_h'] . ' : ' . $val['gls_a']; $results_away[] = $val['gls_h'].' : '.$val['gls_a'];
$events_away[] = $val->home->ss_team_name . ' vs ' . $val->away->ss_team_name; $events_away[] = $val->home->ss_team_name.' vs '.$val->away->ss_team_name;
$away_matches[] = $val->match_id; $away_matches[] = $val->match_id;
} }
break; break;
@@ -128,7 +128,6 @@ class LoadPerformance
$home_av = self::makeAv($homes, $length); $home_av = self::makeAv($homes, $length);
$away_av = self::makeAv($aways, $length); $away_av = self::makeAv($aways, $length);
$res = StatistikoPlayer::whereIn('match_id', $league_matches)->select('match_id', 'ss_player_id', 'activeteam_id', 'minutes_played', 'playerrating_value', 'player_position')->get(); $res = StatistikoPlayer::whereIn('match_id', $league_matches)->select('match_id', 'ss_player_id', 'activeteam_id', 'minutes_played', 'playerrating_value', 'player_position')->get();
$league = self::filterMatches($res, $league_matches); $league = self::filterMatches($res, $league_matches);
$league_av = self::leagueAv($league, $length); $league_av = self::leagueAv($league, $length);
@@ -427,7 +426,7 @@ class LoadPerformance
public static function filterMatches($res, array $matches, $team_id = 0) public static function filterMatches($res, array $matches, $team_id = 0)
{ {
if (!$res->count()) { if (! $res->count()) {
return ['all', 'def', 'att', 'mid']; return ['all', 'def', 'att', 'mid'];
} }
@@ -454,7 +453,7 @@ class LoadPerformance
$result[$match_id]['def']['rating'] = 0; $result[$match_id]['def']['rating'] = 0;
} }
if (0 == $team_id || $value->activeteam_id == $team_id) { if ($team_id == 0 || $value->activeteam_id == $team_id) {
if ($value->minutes_played > 0) { if ($value->minutes_played > 0) {
@@ -565,10 +564,10 @@ class LoadPerformance
public static function makeAv(array &$arr, int $length) public static function makeAv(array &$arr, int $length)
{ {
if (isset($arr['all']) && count($arr['all'])) { if (isset($arr['all']) && count($arr['all'])) {
$all = isset($arr['all']) ? array_sum($arr['all']) / count($arr['all']) : 1; $all = isset($arr['all']) ? array_sum($arr['all']) / count($arr['all']) : 1;
$def = isset($arr['def']) ? array_sum($arr['def']) / count($arr['def']) : 1; $def = isset($arr['def']) ? array_sum($arr['def']) / count($arr['def']) : 1;
$mid = isset($arr['mid']) ? array_sum($arr['mid']) / count($arr['mid']) : 1; $mid = isset($arr['mid']) ? array_sum($arr['mid']) / count($arr['mid']) : 1;
$att = isset($arr['att']) ? array_sum($arr['att']) / count($arr['att']) : 1; $att = isset($arr['att']) ? array_sum($arr['att']) / count($arr['att']) : 1;
$ret = []; $ret = [];
$ret['all'] = array_fill(0, $length, round($all, 2)); $ret['all'] = array_fill(0, $length, round($all, 2));
$ret['def'] = array_fill(0, $length, round($def, 2)); $ret['def'] = array_fill(0, $length, round($def, 2));
@@ -1,10 +1,10 @@
<?php <?php
namespace App\Filament\Widgets\Data; namespace App\Filament\Widgets\Charts;
use Illuminate\Support\Carbon;
use App\Models\StatistikoDetail; use App\Models\StatistikoDetail;
use App\Models\StatistikoPlayer; use App\Models\StatistikoPlayer;
use Illuminate\Support\Carbon;
class LoadPlayerPerformance class LoadPlayerPerformance
{ {
@@ -1,6 +1,6 @@
<?php <?php
namespace App\Filament\Widgets\Data; namespace App\Filament\Widgets\Charts;
use App\Filament\Pages\Selections\Helper\GetSeason; use App\Filament\Pages\Selections\Helper\GetSeason;
use App\Models\StatistikoDetail; use App\Models\StatistikoDetail;