TP for boxes and grafic wip
This commit is contained in:
1 parent
1fbf53cf1f
commit
28882bfdb5
3 files changed
+28
-43
No files matched your search
@@ -6,6 +6,7 @@ use App\Filament\Widgets\Boxes\Helper\ExpectationCalculation;
|
|||||||
use App\Filament\Widgets\Boxes\Helper\ExpectationCollecting;
|
use App\Filament\Widgets\Boxes\Helper\ExpectationCollecting;
|
||||||
use App\Filament\Widgets\Boxes\Helper\ExpectationCounting;
|
use App\Filament\Widgets\Boxes\Helper\ExpectationCounting;
|
||||||
use App\Filament\Widgets\Charts\LoadEvents\LoadEventsQueryAll;
|
use App\Filament\Widgets\Charts\LoadEvents\LoadEventsQueryAll;
|
||||||
|
use App\Filament\Widgets\Charts\LoadEvents\LoadEventsQueryTP;
|
||||||
use App\Utilities\Round;
|
use App\Utilities\Round;
|
||||||
use Illuminate\Support\Facades\Log;
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
@@ -31,9 +32,12 @@ class ExpectationsTeam
|
|||||||
}
|
}
|
||||||
|
|
||||||
$res = LoadEventsQueryAll::load($filter, $match);
|
$res = LoadEventsQueryAll::load($filter, $match);
|
||||||
$count_events_selection = $res->count();
|
|
||||||
|
|
||||||
$count_events = ExpectationCounting::count($team_position, $team_id, $res);
|
$res_tp = LoadEventsQueryTP::load($filter, $match);
|
||||||
|
|
||||||
|
$count_tp = $res_tp->count();
|
||||||
|
|
||||||
|
// $count_events = ExpectationCounting::count($team_position, $team_id, $res);
|
||||||
|
|
||||||
// Log::debug('count_events ' . $count_events);
|
// Log::debug('count_events ' . $count_events);
|
||||||
|
|
||||||
@@ -62,10 +66,10 @@ class ExpectationsTeam
|
|||||||
$expectations['tsh']['name'] = 'Total Shots';
|
$expectations['tsh']['name'] = 'Total Shots';
|
||||||
$expectations['home'] = $home_team;
|
$expectations['home'] = $home_team;
|
||||||
$expectations['away'] = $away_team;
|
$expectations['away'] = $away_team;
|
||||||
$expectations['count_events'] = $count_events;
|
$expectations['count_events'] = $count_tp;
|
||||||
|
|
||||||
$expectations += ['win_count' => 0, 'draw_count' => 0, 'lost_count' => 0];
|
$expectations += ['win_count' => 0, 'draw_count' => 0, 'lost_count' => 0];
|
||||||
foreach ($res as $value) {
|
foreach ($res_tp as $value) {
|
||||||
if ($team_id && $team_position == 'home') {
|
if ($team_id && $team_position == 'home') {
|
||||||
switch ($value['result_code']) {
|
switch ($value['result_code']) {
|
||||||
case '1':
|
case '1':
|
||||||
@@ -105,8 +109,8 @@ class ExpectationsTeam
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$expectations['win_odd'] = $expectations['win_count'] ? number_format(Round::odd($count_events_selection / $expectations['win_count']), 2) : 0;
|
$expectations['win_odd'] = $expectations['win_count'] ? number_format(Round::odd($count_tp / $expectations['win_count']), 2) : 0;
|
||||||
$expectations['draw_odd'] = $expectations['draw_count'] ? number_format(Round::odd($count_events_selection / $expectations['draw_count']), 2) : 0;
|
$expectations['draw_odd'] = $expectations['draw_count'] ? number_format(Round::odd($count_tp / $expectations['draw_count']), 2) : 0;
|
||||||
$expectations['lost_odd'] = $expectations['lost_count'] ? number_format(Round::odd($count_events_selection / $expectations['lost_count']), 2) : 0;
|
$expectations['lost_odd'] = $expectations['lost_count'] ? number_format(Round::odd($count_tp / $expectations['lost_count']), 2) : 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -48,19 +48,6 @@ class LoadEventsQueryAll
|
|||||||
$matches_played = [];
|
$matches_played = [];
|
||||||
|
|
||||||
if ($ss_player_id) {
|
if ($ss_player_id) {
|
||||||
// $matches_season = StatistikoEvent::whereIn('season', $season)
|
|
||||||
// ->where(function ($query) use ($team_id, $team_position) {
|
|
||||||
// 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);
|
|
||||||
// }
|
|
||||||
// })->pluck('match_id')->toArray();
|
|
||||||
|
|
||||||
$matches_season = StatistikoEvent::whereIn('season', $season)
|
$matches_season = StatistikoEvent::whereIn('season', $season)
|
||||||
->where(function ($query) use ($team_id) {
|
->where(function ($query) use ($team_id) {
|
||||||
return $query->where('home_id', '=', $team_id)
|
return $query->where('home_id', '=', $team_id)
|
||||||
@@ -111,19 +98,6 @@ class LoadEventsQueryAll
|
|||||||
return $query->where('home_id', '=', $team_id)
|
return $query->where('home_id', '=', $team_id)
|
||||||
->orWhere('away_id', '=', $team_id);
|
->orWhere('away_id', '=', $team_id);
|
||||||
})
|
})
|
||||||
// ->where(function ($query) use ($team_id, $similar_past_matches, $team_position) {
|
|
||||||
// if ($team_id && $similar_past_matches == 'none') {
|
|
||||||
// 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, $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);
|
||||||
|
|||||||
+17
-10
@@ -6,7 +6,7 @@ use App\Filament\Pages\Selections\Helper\GetSeason;
|
|||||||
use App\Models\StatistikoEvent;
|
use App\Models\StatistikoEvent;
|
||||||
use App\Models\StatistikoPlayer;
|
use App\Models\StatistikoPlayer;
|
||||||
|
|
||||||
class LoadEventsQuerySPM
|
class LoadEventsQueryTP
|
||||||
{
|
{
|
||||||
public static function load(array $filter, object $match)
|
public static function load(array $filter, object $match)
|
||||||
{
|
{
|
||||||
@@ -26,8 +26,6 @@ class LoadEventsQuerySPM
|
|||||||
$player_on_field = $filter['player_on_field'] ?? 'all';
|
$player_on_field = $filter['player_on_field'] ?? 'all';
|
||||||
$similar_past_matches = $filter['similar_past_matches'];
|
$similar_past_matches = $filter['similar_past_matches'];
|
||||||
$team_position = $filter['team_position'];
|
$team_position = $filter['team_position'];
|
||||||
$home_id = $match->home_id;
|
|
||||||
$away_id = $match->away_id;
|
|
||||||
|
|
||||||
$handicap_range = [];
|
$handicap_range = [];
|
||||||
$total_range = [];
|
$total_range = [];
|
||||||
@@ -63,6 +61,12 @@ class LoadEventsQuerySPM
|
|||||||
}
|
}
|
||||||
})->pluck('match_id')->toArray();
|
})->pluck('match_id')->toArray();
|
||||||
|
|
||||||
|
$matches_season = StatistikoEvent::whereIn('season', $season)
|
||||||
|
->where(function ($query) use ($team_id) {
|
||||||
|
return $query->where('home_id', '=', $team_id)
|
||||||
|
->orWhere('away_id', '=', $team_id);
|
||||||
|
})->pluck('match_id')->toArray();
|
||||||
|
|
||||||
$matches_played = StatistikoPlayer::query()
|
$matches_played = StatistikoPlayer::query()
|
||||||
->whereIn('match_id', $matches_season)
|
->whereIn('match_id', $matches_season)
|
||||||
->where('ss_player_id', $ss_player_id)
|
->where('ss_player_id', $ss_player_id)
|
||||||
@@ -103,13 +107,16 @@ class LoadEventsQuerySPM
|
|||||||
return $query->where('league_id', $league_id);
|
return $query->where('league_id', $league_id);
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
->where(function ($query) use ($team_id, $home_id, $away_id, $similar_past_matches) {
|
->where(function ($query) use ($team_id, $similar_past_matches, $team_position) {
|
||||||
if ($similar_past_matches == 'none') {
|
if ($team_id && $similar_past_matches == 'none') {
|
||||||
if ($team_id) {
|
switch ($team_position) {
|
||||||
return $query->orWhere('home_id', $team_id)
|
case 'home':
|
||||||
->orWhere('away_id', '=', $team_id);
|
return $query->where('home_id', '=', $team_id);
|
||||||
} else {
|
case 'away':
|
||||||
return $query->whereIn('home_id', [$home_id, $away_id])->orWhereIn('away_id', [$home_id, $away_id]);
|
return $query->where('away_id', '=', $team_id);
|
||||||
|
default:
|
||||||
|
return $query->where('home_id', '=', $team_id)
|
||||||
|
->orWhere('away_id', '=', $team_id);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
Reference in new issue
Block a user