wiip
This commit is contained in:
1 parent
82f3654a05
commit
be4a08982e
8 files changed
+364
-326
No files matched your search
@@ -42,9 +42,11 @@ class LoadEvents
|
||||
$total_range = [];
|
||||
$match = StatisticFixtures::with('home')->with('away')->where('id', (int) $match_id)->first();
|
||||
|
||||
if (! $match) {
|
||||
return [];
|
||||
}
|
||||
// dd($match);
|
||||
|
||||
// if (! $match) {
|
||||
// return [];
|
||||
// }
|
||||
|
||||
if ($similar_past_matches != 'none') {
|
||||
|
||||
@@ -361,7 +363,7 @@ class LoadEvents
|
||||
];
|
||||
}
|
||||
|
||||
// Log::debug($results);
|
||||
// dd($data);
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Widgets\Data\LoadEvents;
|
||||
|
||||
use App\Filament\Pages\Selections\Helper\GetSeason;
|
||||
use App\Models\StatistikoEvent;
|
||||
use App\Models\StatistikoPlayer;
|
||||
|
||||
@@ -12,14 +13,19 @@ class LoadEventsQuery
|
||||
$league_id = (int) $filter['league_id'] ?? 0;
|
||||
$team_id = (int) $filter['team_id'] ?? 0;
|
||||
$season = $filter['season'] ?? 0;
|
||||
$sofascore_category_id = $filter['sofascore_category_id'] ?? 0;
|
||||
$season_or_date = $filter['season_or_date'];
|
||||
$start = $filter['start_date'] ?? 0;
|
||||
$end = $filter['end_date'] ?? 0;
|
||||
if ($season_or_date == 'season') {
|
||||
$start = 0;
|
||||
$end = 0;
|
||||
}
|
||||
$ss_player_id = (int) $filter['ss_player_id'] ?? 0;
|
||||
$player_on_field = $filter['player_on_field'] ?? 'all';
|
||||
$similar_past_matches = $filter['similar_past_matches'];
|
||||
$statistic_type = $filter['statistic_type'] ?? 'gls';
|
||||
$team_position = $filter['team_position'];
|
||||
$season_or_date = $filter['season_or_date'] ?? 'season';
|
||||
$home_id = $match->home_id;
|
||||
$away_id = $match->away_id;
|
||||
|
||||
@@ -27,15 +33,9 @@ class LoadEventsQuery
|
||||
$statistic_type = 'gls';
|
||||
}
|
||||
|
||||
switch ($season_or_date) {
|
||||
case 'season':
|
||||
$start = 0;
|
||||
$end = 0;
|
||||
break;
|
||||
default:
|
||||
$season = 0;
|
||||
break;
|
||||
}
|
||||
$season = GetSeason::load($season, $sofascore_category_id);
|
||||
|
||||
// dd($season);
|
||||
|
||||
/**
|
||||
* IF WITH PLAYER
|
||||
@@ -107,13 +107,13 @@ class LoadEventsQuery
|
||||
}
|
||||
}
|
||||
})
|
||||
->when($matches_played, function ($query) use ($matches_played, $player_on_field) {
|
||||
if ($player_on_field == 'notplayed') {
|
||||
return $query->whereNotIn('match_id', $matches_played);
|
||||
} else {
|
||||
return $query->whereIn('match_id', $matches_played);
|
||||
}
|
||||
})
|
||||
// ->when($matches_played, function ($query) use ($matches_played, $player_on_field) {
|
||||
// if ($player_on_field == 'notplayed') {
|
||||
// return $query->whereNotIn('match_id', $matches_played);
|
||||
// } else {
|
||||
// return $query->whereIn('match_id', $matches_played);
|
||||
// }
|
||||
// })
|
||||
->when($handicap_range, function ($query) use ($handicap_range) {
|
||||
return $query->whereBetween('exp_handicap', $handicap_range);
|
||||
})->when($total_range, function ($query) use ($total_range) {
|
||||
@@ -122,12 +122,15 @@ class LoadEventsQuery
|
||||
return $query->whereDate('starttime', '>=', $start);
|
||||
})->when($end, function ($query) use ($end) {
|
||||
return $query->whereDate('starttime', '<=', $end);
|
||||
})->when($season, function ($query) use ($season) {
|
||||
return $query->whereIn('season', $season);
|
||||
})->when($season, function ($query) use ($season, $season_or_date) {
|
||||
if ($season_or_date == 'season')
|
||||
return $query->whereIn('season', $season);
|
||||
})
|
||||
->orderBy('starttime', 'ASC')
|
||||
->get();
|
||||
|
||||
// dd($res);
|
||||
|
||||
$arr = [];
|
||||
foreach ($res as $value) {
|
||||
|
||||
|
||||
@@ -47,21 +47,14 @@ class LoadPlayer
|
||||
|
||||
$res = StatistikoPlayer::with('event')->where('ss_player_id', (int) $ss_player_id)->get();
|
||||
|
||||
// dd($res);
|
||||
|
||||
|
||||
$tmp = [];
|
||||
foreach ($res as $value) {
|
||||
|
||||
// dd($value);
|
||||
|
||||
$val = 0;
|
||||
$key = 0;
|
||||
|
||||
if (isset($value->event->starttime)) {
|
||||
|
||||
// $labels[] = $value->event->starttime->format('d.M.y');
|
||||
|
||||
$key = round($value->event->starttime->diffInDays(Carbon::now()));
|
||||
|
||||
switch ($statistic_type) {
|
||||
@@ -92,6 +85,7 @@ class LoadPlayer
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
krsort($tmp);
|
||||
$dataset = [];
|
||||
$labels = [];
|
||||
|
||||
@@ -35,6 +35,7 @@ class StatsMedianAverage extends StatsOverviewWidget
|
||||
protected function getStats(): array
|
||||
{
|
||||
$data = LoadEvents::load($this->filters, false);
|
||||
|
||||
$team_id = (int) $this->filters['team_id'] ?? 0;
|
||||
|
||||
$season = $this->filters['season'] ?? 0;
|
||||
@@ -45,9 +46,9 @@ class StatsMedianAverage extends StatsOverviewWidget
|
||||
switch ($season_or_date) {
|
||||
case 'season':
|
||||
if ($season)
|
||||
$date_events = implode(',', $season);
|
||||
$date_events = implode(', ', $season);
|
||||
else
|
||||
$date_events = 'All Seasons';
|
||||
$date_events = 'Current Season';
|
||||
break;
|
||||
default:
|
||||
$start = $this->filters['start_date'] ?? 0;
|
||||
|
||||
Reference in new issue
Block a user