wip
This commit is contained in:
1 parent
4cdec4be8e
commit
b74c374586
3 files changed
+13
-13
No files matched your search
@@ -169,6 +169,7 @@ class Statistic extends BaseDashboard
|
||||
Select::make('match_id')
|
||||
->live()
|
||||
->hiddenLabel()
|
||||
->columnSpan(fn (Get $get) => $get('similar_past_matches') != 'none' ? 2 : 1)
|
||||
->prefixIconColor(fn (Get $get): string => $get('match_id') ? 'success' : 'danger')
|
||||
->prefixIcon('phosphor-calendar-check-fill')
|
||||
->options(function (Get $get) {
|
||||
@@ -278,7 +279,9 @@ class Statistic extends BaseDashboard
|
||||
************************/
|
||||
Select::make('similar_past_matches')
|
||||
->live()
|
||||
// ->columnSpan(2)
|
||||
->hiddenLabel()
|
||||
->columnSpan(fn (Get $get) => $get('similar_past_matches') != 'none' ? 2 : 1)
|
||||
->suffixAction(Action::make('reset')
|
||||
->icon('phosphor-x-circle')
|
||||
->action(fn (callable $set) => $set('similar_past_matches', 'none'))
|
||||
|
||||
@@ -17,6 +17,7 @@ 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'];
|
||||
|
||||
@@ -43,6 +44,8 @@ class LoadEvents
|
||||
|
||||
$match = StatisticFixtures::with('home')->with('away')->where('id', (int) $match_id)->first();
|
||||
|
||||
// dd($match);
|
||||
|
||||
if (! $match) {
|
||||
return [];
|
||||
}
|
||||
@@ -94,13 +97,10 @@ class LoadEvents
|
||||
}
|
||||
|
||||
$expectations = LoadExpectations::load($res['all'], $match, $statistic_type);
|
||||
|
||||
// dd($expectations);
|
||||
$label1 = '';
|
||||
$label2 = '';
|
||||
$label3 = '';
|
||||
$label4 = '';
|
||||
|
||||
if ($team_id) {
|
||||
foreach ($res[$team_position] as $value) {
|
||||
|
||||
@@ -240,6 +240,9 @@ class LoadEvents
|
||||
$dataset_home2 = [];
|
||||
$dataset_away2 = [];
|
||||
|
||||
$home_id = $match->home_id;
|
||||
$away_id = $match->away_id;
|
||||
|
||||
foreach ($res[$team_position] as $value) {
|
||||
|
||||
$labels[] = round($value['starttime']->diffInDays(Carbon::now()));
|
||||
@@ -267,13 +270,8 @@ class LoadEvents
|
||||
$dataset_away[] = (int) $value['val_home'];
|
||||
}
|
||||
} else {
|
||||
if ($match->home_id == $value['home_id']) {
|
||||
$dataset_home[] = (int) $value['val_home'];
|
||||
$dataset_away[] = (int) $value['val_away'];
|
||||
} else {
|
||||
$dataset_home[] = (int) $value['val_away'];
|
||||
$dataset_away[] = (int) $value['val_home'];
|
||||
}
|
||||
$dataset_home[] = (int) $value['val_home'];
|
||||
$dataset_away[] = (int) $value['val_away'];
|
||||
}
|
||||
|
||||
// Home playing AWAY done and commited
|
||||
@@ -284,7 +282,6 @@ class LoadEvents
|
||||
$dataset_home2[] = (int) $value['val_away'];
|
||||
$dataset_away2[] = (int) $value['val_home'];
|
||||
}
|
||||
|
||||
}
|
||||
$n = max(count($dataset_home), count($dataset_away), count($dataset_away2), count($dataset_home2));
|
||||
if ($n) {
|
||||
@@ -372,7 +369,7 @@ class LoadEvents
|
||||
];
|
||||
}
|
||||
|
||||
if ($label3 && $label4 && isset($dataset_home2) && isset($dataset_away2)) {
|
||||
if (isset($dataset_home2) && isset($dataset_away2)) {
|
||||
$data['datasets'][] = [
|
||||
'label' => $label3,
|
||||
'events' => $events,
|
||||
|
||||
@@ -157,7 +157,7 @@ class StatsMedianAverage extends StatsOverviewWidget
|
||||
if ($similar_past_matches != 'none') {
|
||||
// BOX 2
|
||||
$boxes[] = Stat::make('Total', self::template_box2($total_home))
|
||||
->description(fn () => new HtmlString($date_events))
|
||||
->description(fn () => $similar_past_matches == 'all' ? 'SPM Source Database' : 'SPM Source League')
|
||||
->extraAttributes([
|
||||
'x-init' => "animate('number-of-events', $total_home);",
|
||||
'class' => 'box-info',
|
||||
|
||||
Reference in new issue
Block a user