wip
This commit is contained in:
1 parent
f6f898c207
commit
68607108b4
6 files changed
+27
-32
No files matched your search
@@ -3,19 +3,20 @@
|
|||||||
namespace App\Filament\Pages\Selections\Helper;
|
namespace App\Filament\Pages\Selections\Helper;
|
||||||
|
|
||||||
use App\Models\SofaScoreCategory;
|
use App\Models\SofaScoreCategory;
|
||||||
use Filament\Schemas\Components\Utilities\Get;
|
|
||||||
|
|
||||||
class GetSeason
|
class GetSeason
|
||||||
{
|
{
|
||||||
public static function load(array $season, int $sofascore_category_id)
|
public static function load(array $season, int|null $sofascore_category_id)
|
||||||
{
|
{
|
||||||
if (!$season) {
|
if (!$season) {
|
||||||
$season_mode = SofaScoreCategory::where('id', $sofascore_category_id)->value('season_mode');
|
if ($sofascore_category_id) {
|
||||||
if ($season_mode == 'halfyear') {
|
$season_mode = SofaScoreCategory::where('id', $sofascore_category_id)->value('season_mode');
|
||||||
if ((int) date('m') > 7)
|
if ($season_mode == 'halfyear') {
|
||||||
$season[] = date('y') . '/' . date('y', strtotime('+1 year'));
|
if ((int) date('m') > 7)
|
||||||
else
|
$season[] = date('y') . '/' . date('y', strtotime('+1 year'));
|
||||||
$season[] = date('y', strtotime('-1 year')) . '/' . date('y');
|
else
|
||||||
|
$season[] = date('y', strtotime('-1 year')) . '/' . date('y');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -11,9 +11,7 @@ class LoadSeasons
|
|||||||
// $res = CompetitionGroup::with('country')->where('id', $league_id)->first();
|
// $res = CompetitionGroup::with('country')->where('id', $league_id)->first();
|
||||||
// $season_mode = $res->country->season_mode;
|
// $season_mode = $res->country->season_mode;
|
||||||
|
|
||||||
$res = StatistikoEvent::where('league_id', $league_id)
|
$res = StatistikoEvent::select('season')->where('league_id', $league_id)->get();
|
||||||
->groupBy('season')
|
|
||||||
->get();
|
|
||||||
|
|
||||||
if (! $res) {
|
if (! $res) {
|
||||||
return [];
|
return [];
|
||||||
@@ -24,7 +22,7 @@ class LoadSeasons
|
|||||||
$arr[$val->season] = $val->season;
|
$arr[$val->season] = $val->season;
|
||||||
}
|
}
|
||||||
|
|
||||||
sort($arr);
|
asort($arr);
|
||||||
|
|
||||||
return $arr;
|
return $arr;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -92,8 +92,6 @@ class LoadEvents
|
|||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
$expectations = LoadExpectations::load($res['all'], $match, $statistic_type);
|
$expectations = LoadExpectations::load($res['all'], $match, $statistic_type);
|
||||||
|
|
||||||
if ($team_id) {
|
if ($team_id) {
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ class LoadEventsQuery
|
|||||||
{
|
{
|
||||||
$league_id = (int) $filter['league_id'] ?? 0;
|
$league_id = (int) $filter['league_id'] ?? 0;
|
||||||
$team_id = (int) $filter['team_id'] ?? 0;
|
$team_id = (int) $filter['team_id'] ?? 0;
|
||||||
$season = $filter['season'] ?? 0;
|
$season = $filter['season'];
|
||||||
$sofascore_category_id = $filter['sofascore_category_id'] ?? 0;
|
$sofascore_category_id = $filter['sofascore_category_id'] ?? 0;
|
||||||
$season_or_date = $filter['season_or_date'];
|
$season_or_date = $filter['season_or_date'];
|
||||||
$start = $filter['start_date'] ?? 0;
|
$start = $filter['start_date'] ?? 0;
|
||||||
@@ -85,7 +85,8 @@ class LoadEventsQuery
|
|||||||
* STATTISTIC DATA
|
* STATTISTIC DATA
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// dd($league_id, $home_id, $away_id);
|
|
||||||
|
// dd($team_id, $home_id, $away_id);
|
||||||
$res = StatistikoEvent::with('home')->with('away')
|
$res = StatistikoEvent::with('home')->with('away')
|
||||||
->where(function ($query) use ($league_id, $similar_past_matches) {
|
->where(function ($query) use ($league_id, $similar_past_matches) {
|
||||||
switch ($similar_past_matches) {
|
switch ($similar_past_matches) {
|
||||||
@@ -97,23 +98,20 @@ class LoadEventsQuery
|
|||||||
->where(function ($query) use ($team_id, $home_id, $away_id, $similar_past_matches) {
|
->where(function ($query) use ($team_id, $home_id, $away_id, $similar_past_matches) {
|
||||||
if ($similar_past_matches == 'none') {
|
if ($similar_past_matches == 'none') {
|
||||||
if ($team_id) {
|
if ($team_id) {
|
||||||
return $query->where('home_id', '=', $team_id)
|
return $query->where('home_id', $team_id)
|
||||||
->orWhere('away_id', '=', $team_id);
|
->orWhere('away_id', '=', $team_id);
|
||||||
} else {
|
} else {
|
||||||
return $query->where('home_id', '=', $home_id)
|
return $query->whereIn('home_id', [$home_id, $away_id])->orWhereIn('away_id', [$home_id, $away_id]);
|
||||||
->orWhere('away_id', '=', $home_id)
|
|
||||||
->orWhere('home_id', '=', $away_id)
|
|
||||||
->orWhere('away_id', '=', $away_id);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// ->when($matches_played, function ($query) use ($matches_played, $player_on_field) {
|
->when($matches_played, function ($query) use ($matches_played, $player_on_field) {
|
||||||
// if ($player_on_field == 'notplayed') {
|
if ($player_on_field == 'notplayed') {
|
||||||
// return $query->whereNotIn('match_id', $matches_played);
|
return $query->whereNotIn('match_id', $matches_played);
|
||||||
// } else {
|
} else {
|
||||||
// return $query->whereIn('match_id', $matches_played);
|
return $query->whereIn('match_id', $matches_played);
|
||||||
// }
|
}
|
||||||
// })
|
})
|
||||||
->when($handicap_range, function ($query) use ($handicap_range) {
|
->when($handicap_range, function ($query) use ($handicap_range) {
|
||||||
return $query->whereBetween('exp_handicap', $handicap_range);
|
return $query->whereBetween('exp_handicap', $handicap_range);
|
||||||
})->when($total_range, function ($query) use ($total_range) {
|
})->when($total_range, function ($query) use ($total_range) {
|
||||||
@@ -122,14 +120,15 @@ class LoadEventsQuery
|
|||||||
return $query->whereDate('starttime', '>=', $start);
|
return $query->whereDate('starttime', '>=', $start);
|
||||||
})->when($end, function ($query) use ($end) {
|
})->when($end, function ($query) use ($end) {
|
||||||
return $query->whereDate('starttime', '<=', $end);
|
return $query->whereDate('starttime', '<=', $end);
|
||||||
})->when($season, function ($query) use ($season, $season_or_date) {
|
})
|
||||||
|
->when($season, function ($query) use ($season, $season_or_date) {
|
||||||
if ($season_or_date == 'season')
|
if ($season_or_date == 'season')
|
||||||
return $query->whereIn('season', $season);
|
return $query->whereIn('season', $season);
|
||||||
})
|
})
|
||||||
->orderBy('starttime', 'ASC')
|
->orderBy('starttime', 'ASC')
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
// dd($res);
|
// dd($season, $res);
|
||||||
|
|
||||||
$arr = [];
|
$arr = [];
|
||||||
foreach ($res as $value) {
|
foreach ($res as $value) {
|
||||||
|
|||||||
@@ -69,8 +69,6 @@ class StatsMedianAverage extends StatsOverviewWidget
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Log::debug($data['datasets']);
|
|
||||||
|
|
||||||
$team_position = HelperTeamPosition::get($this->filters);
|
$team_position = HelperTeamPosition::get($this->filters);
|
||||||
|
|
||||||
if (! $data) {
|
if (! $data) {
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ class StatistikoEvent extends Model
|
|||||||
'starttime' => 'datetime',
|
'starttime' => 'datetime',
|
||||||
];
|
];
|
||||||
|
|
||||||
|
|
||||||
public function sport(): BelongsTo
|
public function sport(): BelongsTo
|
||||||
{
|
{
|
||||||
return $this->belongsTo(Sport::class, 'sport_id', 'id');
|
return $this->belongsTo(Sport::class, 'sport_id', 'id');
|
||||||
|
|||||||
Reference in new issue
Block a user