wip performance
This commit is contained in:
1 parent
7bf4258c4a
commit
5ffbc07564
11 files changed
+575
-32
No files matched your search
@@ -3,6 +3,7 @@
|
||||
namespace App\Filament\Widgets\Charts\LoadEvents;
|
||||
|
||||
use App\Filament\Pages\Selections\Helper\GetSeason;
|
||||
use App\Models\SofaScoreRosa;
|
||||
use App\Models\StatistikoEvent;
|
||||
use App\Models\StatistikoPlayer;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
@@ -87,19 +88,20 @@ class LoadEventsQuery
|
||||
}
|
||||
}
|
||||
|
||||
$team_map = SofaScoreRosa::pluck('ss_team_name', 'ss_team_id')->toArray();
|
||||
|
||||
// dd($handicap_range, $total_range);
|
||||
/**
|
||||
* STATTISTIC DATA
|
||||
*/
|
||||
// dd($team_id, $home_id, $away_id);
|
||||
$res = StatistikoEvent::with('home')->with('away')
|
||||
->where(function ($query) use ($league_id, $similar_past_matches) {
|
||||
switch ($similar_past_matches) {
|
||||
case 'none':
|
||||
case 'league':
|
||||
return $query->where('league_id', $league_id);
|
||||
}
|
||||
})
|
||||
$res = StatistikoEvent::where(function ($query) use ($league_id, $similar_past_matches) {
|
||||
switch ($similar_past_matches) {
|
||||
case 'none':
|
||||
case 'league':
|
||||
return $query->where('league_id', $league_id);
|
||||
}
|
||||
})
|
||||
->where(function ($query) use ($team_id, $home_id, $away_id, $similar_past_matches) {
|
||||
if ($similar_past_matches == 'none') {
|
||||
if ($team_id) {
|
||||
@@ -155,8 +157,8 @@ class LoadEventsQuery
|
||||
$tmp['exp_handicap'] = $value->exp_handicap;
|
||||
$tmp['exp_total'] = $value->exp_total;
|
||||
$tmp['result_code'] = $value->result_code;
|
||||
$tmp['home'] = $value->home->ss_team_name ?? 0;
|
||||
$tmp['away'] = $value->away->ss_team_name ?? 0;
|
||||
$tmp['home'] = $team_map[$value->home_id] ?? 0;
|
||||
$tmp['away'] = $team_map[$value->away_id] ?? 0;
|
||||
|
||||
switch ($statistic_type) {
|
||||
case 'gls':
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Widgets\Charts;
|
||||
|
||||
use App\Models\SofaScoreRosa;
|
||||
use App\Models\StatisticFixtures;
|
||||
use App\Models\StatistikoEvent;
|
||||
use App\Models\StatistikoPlayer;
|
||||
@@ -22,8 +23,6 @@ class LoadPerformance
|
||||
|
||||
$team_position = $filter['team_position'];
|
||||
|
||||
$team_id = (int) $filter['team_id'] ?? 0;
|
||||
|
||||
if (! $league_id) {
|
||||
return [];
|
||||
}
|
||||
@@ -31,18 +30,15 @@ class LoadPerformance
|
||||
return [];
|
||||
}
|
||||
|
||||
$match = StatisticFixtures::with('home')->with('away')->where('id', $match_id)->first();
|
||||
$team_map = SofaScoreRosa::pluck('ss_team_name', 'ss_team_id')->toArray();
|
||||
|
||||
$match = StatisticFixtures::where('id', $match_id)->first();
|
||||
if (! $match) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$home_id = $match->home_id ?? 0;
|
||||
$away_id = $match->away_id ?? 0;
|
||||
|
||||
// $labels[] = round($value['starttime']->diffInDays(Carbon::now()));
|
||||
// $playing_date[] = $value['starttime']->format('Y-m-d H:i');
|
||||
|
||||
$res = StatistikoEvent::where('league_id', $league_id)->get();
|
||||
|
||||
$home_matches = [];
|
||||
@@ -63,14 +59,14 @@ class LoadPerformance
|
||||
$labels[] = round($val->starttime->diffInDays(Carbon::now()));
|
||||
$date_home[] = $val['starttime']->format('Y-m-d H:i');
|
||||
$results_home[] = $val['gls_h'].' : '.$val['gls_a'];
|
||||
$events_home[] = $val->home->ss_team_name.' vs '.$val->away->ss_team_name;
|
||||
$events_home[] = $team_map[$val->home_id].' vs '.$team_map[$val->away_id];
|
||||
$home_matches[] = $val->match_id;
|
||||
}
|
||||
if ($val->away_id == $away_id) {
|
||||
$labels[] = round($val->starttime->diffInDays(Carbon::now()));
|
||||
$date_away[] = $val['starttime']->format('Y-m-d H:i');
|
||||
$results_away[] = $val['gls_h'].' : '.$val['gls_a'];
|
||||
$events_away[] = $val->home->ss_team_name.' vs '.$val->away->ss_team_name;
|
||||
$events_home[] = $team_map[$val->home_id].' vs '.$team_map[$val->away_id];
|
||||
$away_matches[] = $val->match_id;
|
||||
}
|
||||
break;
|
||||
@@ -79,14 +75,14 @@ class LoadPerformance
|
||||
$labels[] = round($val->starttime->diffInDays(Carbon::now()));
|
||||
$date_home[] = $val['starttime']->format('Y-m-d H:i');
|
||||
$results_home[] = $val['gls_h'].' : '.$val['gls_a'];
|
||||
$events_home[] = $val->home->name.' vs '.$val->away->name;
|
||||
$events_home[] = $team_map[$val->home_id].' vs '.$team_map[$val->away_id];
|
||||
$home_matches[] = $val->match_id;
|
||||
}
|
||||
if ($val->home_id == $away_id) {
|
||||
$labels[] = round($val->starttime->diffInDays(Carbon::now()));
|
||||
$date_away[] = $val['starttime']->format('Y-m-d H:i');
|
||||
$results_away[] = $val['gls_h'].' : '.$val['gls_a'];
|
||||
$events_away[] = $val->home->ss_team_name.' vs '.$val->away->ss_team_name;
|
||||
$events_home[] = $team_map[$val->home_id].' vs '.$team_map[$val->away_id];
|
||||
$away_matches[] = $val->match_id;
|
||||
}
|
||||
break;
|
||||
@@ -95,14 +91,14 @@ class LoadPerformance
|
||||
$labels[] = round($val->starttime->diffInDays(Carbon::now()));
|
||||
$date_home[] = $val['starttime']->format('Y-m-d H:i');
|
||||
$results_home[] = $val['gls_h'].' : '.$val['gls_a'];
|
||||
$events_home[] = $val->home->ss_team_name.' vs '.$val->away->ss_team_name;
|
||||
$events_home[] = $team_map[$val->home_id].' vs '.$team_map[$val->away_id];
|
||||
$home_matches[] = $val->match_id;
|
||||
}
|
||||
if ($val->home_id == $away_id or $val->away_id == $away_id) {
|
||||
$labels[] = round($val->starttime->diffInDays(Carbon::now()));
|
||||
$date_away[] = $val['starttime']->format('Y-m-d H:i');
|
||||
$results_away[] = $val['gls_h'].' : '.$val['gls_a'];
|
||||
$events_away[] = $val->home->ss_team_name.' vs '.$val->away->ss_team_name;
|
||||
$events_home[] = $team_map[$val->home_id].' vs '.$team_map[$val->away_id];
|
||||
$away_matches[] = $val->match_id;
|
||||
}
|
||||
break;
|
||||
@@ -135,7 +131,7 @@ class LoadPerformance
|
||||
$data = [
|
||||
'datasets' => [
|
||||
[
|
||||
'label' => $match->home->ss_team_name,
|
||||
'label' => $team_map[$match->home_id],
|
||||
'playing_date' => $date_home,
|
||||
'results_per_event' => $results_home,
|
||||
'events' => $events_home,
|
||||
@@ -246,7 +242,7 @@ class LoadPerformance
|
||||
'hidden' => true,
|
||||
],
|
||||
[
|
||||
'label' => $match->away->ss_team_name,
|
||||
'label' => $team_map[$match->away_id],
|
||||
'playing_date' => $date_away,
|
||||
'results_per_event' => $results_away,
|
||||
'events' => $events_away,
|
||||
|
||||
Reference in new issue
Block a user