wip
This commit is contained in:
1 parent
e2d986e4c5
commit
a4f7447fa7
2 files changed
+48
-11
No files matched your search
@@ -133,7 +133,8 @@ class Statistic extends BaseDashboard
|
|||||||
->decimalPlaces(1)
|
->decimalPlaces(1)
|
||||||
->tooltips()
|
->tooltips()
|
||||||
->range(minValue: 0, maxValue: 1)
|
->range(minValue: 0, maxValue: 1)
|
||||||
->pips(),
|
->pips()
|
||||||
|
->live(),
|
||||||
// Select::make('accuracy')
|
// Select::make('accuracy')
|
||||||
// ->disabled(fn (Get $get) => $get('similar_past_matches') == 'none')
|
// ->disabled(fn (Get $get) => $get('similar_past_matches') == 'none')
|
||||||
// ->default(0.5)
|
// ->default(0.5)
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
namespace App\Filament\Widgets\Data;
|
namespace App\Filament\Widgets\Data;
|
||||||
|
|
||||||
|
use App\Models\StatisticFixtures;
|
||||||
use App\Models\StatistikoDetail;
|
use App\Models\StatistikoDetail;
|
||||||
use App\Models\StatistikoEvent;
|
use App\Models\StatistikoEvent;
|
||||||
use App\Models\StatistikoPlayer;
|
use App\Models\StatistikoPlayer;
|
||||||
@@ -38,6 +39,8 @@ class LoadEvents
|
|||||||
|
|
||||||
$accuracy = (float) $filter['accuracy'];
|
$accuracy = (float) $filter['accuracy'];
|
||||||
|
|
||||||
|
$similar_past_matches = $filter['similar_past_matches'];
|
||||||
|
|
||||||
if (! $league_id) {
|
if (! $league_id) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
@@ -49,6 +52,27 @@ class LoadEvents
|
|||||||
$statistic_type = 'gls';
|
$statistic_type = 'gls';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IF WITH SIMILAR_PAST_MATCHES
|
||||||
|
*
|
||||||
|
* 'none' => 'None',
|
||||||
|
* 'league' => 'League',
|
||||||
|
* 'all' => 'All Database',
|
||||||
|
*/
|
||||||
|
$handicap_range = 0;
|
||||||
|
$total_range = 0;
|
||||||
|
if ($similar_past_matches != 'none') {
|
||||||
|
$res = StatisticFixtures::where('id', (int) $match_id)->first();
|
||||||
|
|
||||||
|
$exp_handicap = $res->exp_away - $res->exp_home;
|
||||||
|
|
||||||
|
$exp_total = $res->exp_away + $res->exp_home;
|
||||||
|
|
||||||
|
$handicap_range = [$exp_handicap - $accuracy, $exp_handicap + $accuracy];
|
||||||
|
|
||||||
|
$total_range = [$exp_total - $accuracy, $exp_total + $accuracy];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* IF WITH PLAYER
|
* IF WITH PLAYER
|
||||||
*/
|
*/
|
||||||
@@ -78,19 +102,31 @@ class LoadEvents
|
|||||||
*/
|
*/
|
||||||
$res = StatistikoEvent::with('home')
|
$res = StatistikoEvent::with('home')
|
||||||
->with('away')
|
->with('away')
|
||||||
->where('league_id', $league_id)
|
->where(function ($query) use ($league_id, $similar_past_matches) {
|
||||||
->where(function ($query) use ($team_id, $team_position) {
|
switch ($similar_past_matches) {
|
||||||
switch ($team_position) {
|
case 'none':
|
||||||
case 'home':
|
case 'league':
|
||||||
return $query->where('home_id', '=', $team_id);
|
return $query->where('league_id', $league_id);
|
||||||
case 'away':
|
}
|
||||||
return $query->where('away_id', '=', $team_id);
|
})
|
||||||
default:
|
->where(function ($query) use ($team_id, $team_position, $similar_past_matches) {
|
||||||
return $query->where('home_id', '=', $team_id)
|
if ($similar_past_matches == 'none') {
|
||||||
->orWhere('away_id', '=', $team_id);
|
switch ($team_position) {
|
||||||
|
case 'home':
|
||||||
|
return $query->where('home_id', '=', $team_id);
|
||||||
|
case 'away':
|
||||||
|
return $query->where('away_id', '=', $team_id);
|
||||||
|
default:
|
||||||
|
return $query->where('home_id', '=', $team_id)
|
||||||
|
->orWhere('away_id', '=', $team_id);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
})->when($matches_played, function ($query) use ($matches_played) {
|
})->when($matches_played, function ($query) use ($matches_played) {
|
||||||
return $query->whereIn('match_id', $matches_played);
|
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) {
|
||||||
|
return $query->whereBetween('exp_total', $total_range);
|
||||||
})->when($start, function ($query) use ($start) {
|
})->when($start, function ($query) use ($start) {
|
||||||
return $query->where('starttime', '>=', $start);
|
return $query->where('starttime', '>=', $start);
|
||||||
})->when($end, function ($query) use ($end) {
|
})->when($end, function ($query) use ($end) {
|
||||||
|
|||||||
Reference in new issue
Block a user