changes Ubaldo before Logomatic
This commit is contained in:
1 parent
498660e9cc
commit
f9e8b17d58
11 files changed
+607
-843
No files matched your search
@@ -17,7 +17,6 @@ class LoadEvents
|
||||
$team_id = (int) $filter['team_id'] ?? 0;
|
||||
$statistic_type = $filter['statistic_type'] ?? 'gls';
|
||||
$team_position = $filter['team_position'];
|
||||
$seasonmode = $filter['seasonmode'];
|
||||
$accuracy = (float) $filter['accuracy'] ?? 0.5;
|
||||
$similar_past_matches = $filter['similar_past_matches'];
|
||||
|
||||
@@ -28,6 +27,10 @@ class LoadEvents
|
||||
return [];
|
||||
}
|
||||
|
||||
if (! $team_id && $similar_past_matches == 'none') {
|
||||
return [];
|
||||
}
|
||||
|
||||
if ($statistic_type == 'none') {
|
||||
$statistic_type = 'gls';
|
||||
}
|
||||
@@ -128,10 +131,10 @@ class LoadEvents
|
||||
break;
|
||||
}
|
||||
|
||||
if ($statistic_type == 'gls') {
|
||||
$dataset_exp_home[] = (float) round($value['exp_home'], 1);
|
||||
$dataset_exp_away[] = (float) round($value['exp_away'], 1);
|
||||
}
|
||||
// if ($statistic_type == 'gls') {
|
||||
// $dataset_exp_home[] = (float) round($value['exp_home'], 1);
|
||||
// $dataset_exp_away[] = (float) round($value['exp_away'], 1);
|
||||
// }
|
||||
} else {
|
||||
if ($team_position == 'home') {
|
||||
switch ($value['result_code']) {
|
||||
@@ -148,10 +151,10 @@ class LoadEvents
|
||||
break;
|
||||
}
|
||||
|
||||
if ($statistic_type == 'gls') {
|
||||
$dataset_exp_home[] = (float) round($value['exp_home'], 1);
|
||||
$dataset_exp_away[] = (float) round($value['exp_away'], 1);
|
||||
}
|
||||
// if ($statistic_type == 'gls') {
|
||||
// $dataset_exp_home[] = (float) round($value['exp_home'], 1);
|
||||
// $dataset_exp_away[] = (float) round($value['exp_away'], 1);
|
||||
// }
|
||||
} elseif ($team_position == 'away') {
|
||||
|
||||
switch ($value['result_code']) {
|
||||
@@ -168,10 +171,10 @@ class LoadEvents
|
||||
break;
|
||||
}
|
||||
|
||||
if ($statistic_type == 'gls') {
|
||||
$dataset_exp_home[] = (float) round($value['exp_away'], 1);
|
||||
$dataset_exp_away[] = (float) round($value['exp_home'], 1);
|
||||
}
|
||||
// if ($statistic_type == 'gls') {
|
||||
// $dataset_exp_home[] = (float) round($value['exp_away'], 1);
|
||||
// $dataset_exp_away[] = (float) round($value['exp_home'], 1);
|
||||
// }
|
||||
} else {
|
||||
|
||||
// dd($team_id, $value['home_id'], $value['away_id']);
|
||||
@@ -200,10 +203,10 @@ class LoadEvents
|
||||
break;
|
||||
}
|
||||
|
||||
if ($statistic_type == 'gls') {
|
||||
$dataset_exp_home[] = (float) round($value['exp_away'], 1);
|
||||
$dataset_exp_away[] = (float) round($value['exp_home'], 1);
|
||||
}
|
||||
// if ($statistic_type == 'gls') {
|
||||
// $dataset_exp_home[] = (float) round($value['exp_away'], 1);
|
||||
// $dataset_exp_away[] = (float) round($value['exp_home'], 1);
|
||||
// }
|
||||
}
|
||||
}
|
||||
if (isset($val_home) && isset($val_away)) {
|
||||
@@ -240,8 +243,8 @@ class LoadEvents
|
||||
$dataset_home2 = [];
|
||||
$dataset_away2 = [];
|
||||
|
||||
$home_id = $match->home_id;
|
||||
$away_id = $match->away_id;
|
||||
// $home_id = $match->home_id;
|
||||
// $away_id = $match->away_id;
|
||||
|
||||
foreach ($res[$team_position] as $value) {
|
||||
|
||||
@@ -310,13 +313,13 @@ class LoadEvents
|
||||
'results_per_event' => $results_per_event,
|
||||
'data' => $dataset_home,
|
||||
'tension' => 0.5,
|
||||
'borderColor' => '#fb2c36',
|
||||
'backgroundColor' => '#fb2c36',
|
||||
'borderColor' => '#00c950',
|
||||
'backgroundColor' => '#00c950',
|
||||
'pointStyle' => $hasdots,
|
||||
'fill' => [
|
||||
'target' => 1,
|
||||
'above' => '#fb2c3680',
|
||||
'below' => '#fdc70080',
|
||||
'above' => '#00c95080',
|
||||
'below' => '#2b7fff80',
|
||||
],
|
||||
],
|
||||
[
|
||||
@@ -326,11 +329,11 @@ class LoadEvents
|
||||
'results_per_event' => $results_per_event,
|
||||
'data' => $dataset_away,
|
||||
'tension' => 0.5,
|
||||
'borderColor' => '#fdc700',
|
||||
'backgroundColor' => '#fdc700',
|
||||
'borderColor' => '#2b7fff',
|
||||
'backgroundColor' => '#2b7fff',
|
||||
'pointStyle' => $hasdots,
|
||||
'fill' => false,
|
||||
'hidden' => true,
|
||||
'hidden' => false,
|
||||
],
|
||||
],
|
||||
'labels' => $labels,
|
||||
@@ -342,32 +345,32 @@ class LoadEvents
|
||||
'expectations_home' => $expectations['home'],
|
||||
'expectations_away' => $expectations['away'],
|
||||
];
|
||||
if ($team_id && $statistic_type == 'gls') {
|
||||
$data['datasets'][] = [
|
||||
'label' => 'Goals '.$label1,
|
||||
'events' => $events,
|
||||
'playing_date' => $playing_date,
|
||||
'results_per_event' => $results_per_event,
|
||||
'data' => $dataset_exp_home,
|
||||
'tension' => 0.5,
|
||||
'borderColor' => '#00c950',
|
||||
'backgroundColor' => '#00c950',
|
||||
'pointStyle' => $hasdots,
|
||||
'hidden' => true,
|
||||
];
|
||||
$data['datasets'][] = [
|
||||
'label' => 'Goals '.$label2,
|
||||
'events' => $events,
|
||||
'playing_date' => $playing_date,
|
||||
'results_per_event' => $results_per_event,
|
||||
'data' => $dataset_exp_away,
|
||||
'tension' => 0.5,
|
||||
'borderColor' => '#2b7fff',
|
||||
'backgroundColor' => '#2b7fff',
|
||||
'pointStyle' => $hasdots,
|
||||
'hidden' => true,
|
||||
];
|
||||
}
|
||||
// if ($team_id && $statistic_type == 'gls') {
|
||||
// $data['datasets'][] = [
|
||||
// 'label' => 'Goals '.$label1,
|
||||
// 'events' => $events,
|
||||
// 'playing_date' => $playing_date,
|
||||
// 'results_per_event' => $results_per_event,
|
||||
// 'data' => $dataset_exp_home,
|
||||
// 'tension' => 0.5,
|
||||
// 'borderColor' => '#00c950',
|
||||
// 'backgroundColor' => '#00c950',
|
||||
// 'pointStyle' => $hasdots,
|
||||
// 'hidden' => true,
|
||||
// ];
|
||||
// $data['datasets'][] = [
|
||||
// 'label' => 'Goals '.$label2,
|
||||
// 'events' => $events,
|
||||
// 'playing_date' => $playing_date,
|
||||
// 'results_per_event' => $results_per_event,
|
||||
// 'data' => $dataset_exp_away,
|
||||
// 'tension' => 0.5,
|
||||
// 'borderColor' => '#2b7fff',
|
||||
// 'backgroundColor' => '#2b7fff',
|
||||
// 'pointStyle' => $hasdots,
|
||||
// 'hidden' => true,
|
||||
// ];
|
||||
// }
|
||||
|
||||
if (isset($dataset_home2) && isset($dataset_away2)) {
|
||||
$data['datasets'][] = [
|
||||
|
||||
@@ -252,8 +252,8 @@ class LoadEventsAverages
|
||||
'events' => $events,
|
||||
'data' => $data_team,
|
||||
'tension' => 0.5,
|
||||
'borderColor' => '#ad46ff',
|
||||
'backgroundColor' => '#ad46ff',
|
||||
'borderColor' => '#00c950',
|
||||
// 'backgroundColor' => '#ad46ff',
|
||||
'borderDash' => [5, 5],
|
||||
'pointStyle' => false,
|
||||
'hidden' => false,
|
||||
@@ -265,8 +265,8 @@ class LoadEventsAverages
|
||||
'events' => $events,
|
||||
'data' => $data_league,
|
||||
'tension' => 0.5,
|
||||
'borderColor' => '#00bba7',
|
||||
'backgroundColor' => '#00bba7',
|
||||
'borderColor' => '#2b7fff',
|
||||
// 'backgroundColor' => '#00bba7',
|
||||
'borderDash' => [5, 5],
|
||||
'pointStyle' => false,
|
||||
'hidden' => false,
|
||||
|
||||
@@ -48,17 +48,23 @@ class LoadEventsQueryAll
|
||||
$matches_played = [];
|
||||
|
||||
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)
|
||||
->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);
|
||||
}
|
||||
->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()
|
||||
@@ -101,19 +107,23 @@ class LoadEventsQueryAll
|
||||
return $query->where('league_id', $league_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);
|
||||
}
|
||||
}
|
||||
->where(function ($query) use ($team_id) {
|
||||
return $query->where('home_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) {
|
||||
if ($player_on_field == 'notplayed') {
|
||||
return $query->whereNotIn('match_id', $matches_played);
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
|
||||
namespace App\Filament\Widgets\Charts;
|
||||
|
||||
use App\Filament\Pages\Selections\Helper\GetSeason;
|
||||
use App\Models\SofaScoreRosa;
|
||||
use App\Models\StatisticFixtures;
|
||||
use App\Models\StatistikoEvent;
|
||||
@@ -21,14 +22,34 @@ class LoadPerformance
|
||||
|
||||
$match_id = (int) $filter['match_id'] ?? 0;
|
||||
|
||||
$team_id = (int) $filter['team_id'] ?? 0;
|
||||
|
||||
$team_position = $filter['team_position'];
|
||||
|
||||
$similar_past_matches = $filter['similar_past_matches'];
|
||||
|
||||
$accuracy = (float) $filter['accuracy'] ?? 0.5;
|
||||
|
||||
if (! $league_id) {
|
||||
return [];
|
||||
}
|
||||
if (! $match_id) {
|
||||
return [];
|
||||
}
|
||||
if (! $team_id && $similar_past_matches == 'none') {
|
||||
return [];
|
||||
}
|
||||
|
||||
$start = $filter['start_date'] ?? 0;
|
||||
$end = $filter['end_date'] ?? 0;
|
||||
$season_or_date = $filter['season_or_date'];
|
||||
$season = $filter['season'];
|
||||
$seasonmode = $filter['seasonmode'];
|
||||
if ($season_or_date == 'season') {
|
||||
$start = 0;
|
||||
$end = 0;
|
||||
}
|
||||
$season = GetSeason::load($season, $seasonmode);
|
||||
|
||||
$team_map = SofaScoreRosa::pluck('ss_team_name', 'ss_team_id')->toArray();
|
||||
|
||||
@@ -39,7 +60,56 @@ class LoadPerformance
|
||||
$home_id = $match->home_id ?? 0;
|
||||
$away_id = $match->away_id ?? 0;
|
||||
|
||||
$res = StatistikoEvent::where('league_id', $league_id)->get();
|
||||
$handicap_range = [];
|
||||
$total_range = [];
|
||||
|
||||
if ($similar_past_matches != 'none') {
|
||||
|
||||
$team_position = '';
|
||||
|
||||
$exp_handicap = $match->exp_away - $match->exp_home;
|
||||
|
||||
$exp_total = $match->exp_away + $match->exp_home;
|
||||
|
||||
$handicap_range = [$exp_handicap - $accuracy, $exp_handicap + $accuracy];
|
||||
|
||||
$total_range = [$exp_total - $accuracy, $exp_total + $accuracy];
|
||||
}
|
||||
|
||||
// $res = LoadEventsQuery::load($filter, $handicap_range, $total_range, $match, 1);
|
||||
|
||||
// $res = StatistikoEvent::where('league_id', $league_id)->get();
|
||||
|
||||
$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 ($home_id, $away_id, $similar_past_matches) {
|
||||
if ($similar_past_matches == 'none') {
|
||||
return $query->where('home_id', $home_id)->orWhere('away_id', $home_id)->orWhere('away_id', $away_id)->orWhere('away_id', $away_id);
|
||||
}
|
||||
})
|
||||
|
||||
->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) {
|
||||
return $query->whereDate('starttime', '>=', $start);
|
||||
})->when($end, function ($query) use ($end) {
|
||||
return $query->whereDate('starttime', '<=', $end);
|
||||
})
|
||||
->when($season, function ($query) use ($season, $season_or_date, $similar_past_matches) {
|
||||
if ($similar_past_matches == 'none' && $season_or_date == 'season') {
|
||||
return $query->whereIn('season', $season);
|
||||
}
|
||||
})
|
||||
->orderBy('starttime', 'ASC')
|
||||
->get();
|
||||
|
||||
$home_matches = [];
|
||||
$away_matches = [];
|
||||
@@ -66,7 +136,7 @@ class LoadPerformance
|
||||
$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_home[] = $team_map[$val->home_id].' vs '.$team_map[$val->away_id];
|
||||
$events_away[] = $team_map[$val->home_id].' vs '.$team_map[$val->away_id];
|
||||
$away_matches[] = $val->match_id;
|
||||
}
|
||||
break;
|
||||
@@ -82,7 +152,7 @@ class LoadPerformance
|
||||
$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_home[] = $team_map[$val->home_id].' vs '.$team_map[$val->away_id];
|
||||
$events_away[] = $team_map[$val->home_id].' vs '.$team_map[$val->away_id];
|
||||
$away_matches[] = $val->match_id;
|
||||
}
|
||||
break;
|
||||
@@ -98,7 +168,7 @@ class LoadPerformance
|
||||
$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_home[] = $team_map[$val->home_id].' vs '.$team_map[$val->away_id];
|
||||
$events_away[] = $team_map[$val->home_id].' vs '.$team_map[$val->away_id];
|
||||
$away_matches[] = $val->match_id;
|
||||
}
|
||||
break;
|
||||
@@ -241,6 +311,9 @@ class LoadPerformance
|
||||
'borderDash' => [5, 5],
|
||||
'hidden' => true,
|
||||
],
|
||||
/**
|
||||
* AWAY
|
||||
*/
|
||||
[
|
||||
'label' => $team_map[$match->away_id],
|
||||
'playing_date' => $date_away,
|
||||
|
||||
Reference in new issue
Block a user