wip
This commit is contained in:
1 parent
74ff567cce
commit
916fb91895
9 files changed
+503
-346
No files matched your search
@@ -140,10 +140,10 @@ class Statistic extends BaseDashboard
|
|||||||
->live()
|
->live()
|
||||||
->preload()
|
->preload()
|
||||||
->searchable(false)
|
->searchable(false)
|
||||||
->prefixIconColor(fn(Get $get): string => $get('sofascore_category_id') ? 'success' : 'danger')
|
->prefixIconColor(fn (Get $get): string => $get('sofascore_category_id') ? 'success' : 'danger')
|
||||||
->prefixIcon('phosphor-globe')
|
->prefixIcon('phosphor-globe')
|
||||||
->hiddenLabel()
|
->hiddenLabel()
|
||||||
->options(fn() => LoadSofaScoreCategory::load())
|
->options(fn () => LoadSofaScoreCategory::load())
|
||||||
->placeholder('Select Country')
|
->placeholder('Select Country')
|
||||||
->afterStateUpdated(function (callable $set, $state) {
|
->afterStateUpdated(function (callable $set, $state) {
|
||||||
$set('seasonmode', SofaScoreCategory::where('id', $state)->value('season_mode'));
|
$set('seasonmode', SofaScoreCategory::where('id', $state)->value('season_mode'));
|
||||||
@@ -156,10 +156,10 @@ class Statistic extends BaseDashboard
|
|||||||
Select::make('league_id')
|
Select::make('league_id')
|
||||||
->live()
|
->live()
|
||||||
->preload()
|
->preload()
|
||||||
->prefixIconColor(fn(Get $get): string => $get('league_id') ? 'success' : 'danger')
|
->prefixIconColor(fn (Get $get): string => $get('league_id') ? 'success' : 'danger')
|
||||||
->prefixIcon('phosphor-trophy')
|
->prefixIcon('phosphor-trophy')
|
||||||
->hiddenLabel()
|
->hiddenLabel()
|
||||||
->options(fn(Get $get) => LoadStatisticFixturesLeaguesOptions::load($get('sofascore_category_id')))
|
->options(fn (Get $get) => LoadStatisticFixturesLeaguesOptions::load($get('sofascore_category_id')))
|
||||||
->placeholder('Select League')
|
->placeholder('Select League')
|
||||||
->afterStateUpdated(function (callable $set) {
|
->afterStateUpdated(function (callable $set) {
|
||||||
$set('match_id', null);
|
$set('match_id', null);
|
||||||
@@ -170,8 +170,8 @@ class Statistic extends BaseDashboard
|
|||||||
Select::make('match_id')
|
Select::make('match_id')
|
||||||
->live()
|
->live()
|
||||||
->hiddenLabel()
|
->hiddenLabel()
|
||||||
->columnSpan(fn(Get $get) => $get('similar_past_matches') != 'none' ? 2 : 1)
|
->columnSpan(fn (Get $get) => $get('similar_past_matches') != 'none' ? 2 : 1)
|
||||||
->prefixIconColor(fn(Get $get): string => $get('match_id') ? 'success' : 'danger')
|
->prefixIconColor(fn (Get $get): string => $get('match_id') ? 'success' : 'danger')
|
||||||
->prefixIcon('phosphor-calendar-check')
|
->prefixIcon('phosphor-calendar-check')
|
||||||
->options(function (Get $get) {
|
->options(function (Get $get) {
|
||||||
return LoadStatisticFixturesMatchOptions::load($get('league_id'));
|
return LoadStatisticFixturesMatchOptions::load($get('league_id'));
|
||||||
@@ -184,7 +184,7 @@ class Statistic extends BaseDashboard
|
|||||||
->placeholder('Select Event'),
|
->placeholder('Select Event'),
|
||||||
Action::make('esc')
|
Action::make('esc')
|
||||||
->hiddenLabel()
|
->hiddenLabel()
|
||||||
->visible(fn(Get $get) => $get('similar_past_matches') != 'none')
|
->visible(fn (Get $get) => $get('similar_past_matches') != 'none')
|
||||||
->tooltip('Clear All (esc)')
|
->tooltip('Clear All (esc)')
|
||||||
->icon('phosphor-x-circle')
|
->icon('phosphor-x-circle')
|
||||||
->color('danger')
|
->color('danger')
|
||||||
@@ -209,9 +209,9 @@ class Statistic extends BaseDashboard
|
|||||||
->suffixAction(Action::make('reset')
|
->suffixAction(Action::make('reset')
|
||||||
->icon('phosphor-x-circle')
|
->icon('phosphor-x-circle')
|
||||||
->tooltip('Clear Team')
|
->tooltip('Clear Team')
|
||||||
->action(fn(callable $set) => $set('team_id', null))
|
->action(fn (callable $set) => $set('team_id', null))
|
||||||
->color(fn(Get $get): string => $get('team_id') != 0 ? 'danger' : 'gray'))
|
->color(fn (Get $get): string => $get('team_id') != 0 ? 'danger' : 'gray'))
|
||||||
->hidden(fn(Get $get) => $get('similar_past_matches') != 'none')
|
->hidden(fn (Get $get) => $get('similar_past_matches') != 'none')
|
||||||
->options(function (Get $get) {
|
->options(function (Get $get) {
|
||||||
if ($get('match_id')) {
|
if ($get('match_id')) {
|
||||||
$res = StatisticFixtures::where('id', $get('match_id'))->first();
|
$res = StatisticFixtures::where('id', $get('match_id'))->first();
|
||||||
@@ -247,9 +247,9 @@ class Statistic extends BaseDashboard
|
|||||||
Action::make('iconInfo')
|
Action::make('iconInfo')
|
||||||
->color('success')
|
->color('success')
|
||||||
->icon('phosphor-question')
|
->icon('phosphor-question')
|
||||||
->tooltip(fn() => 'Team Position')
|
->tooltip(fn () => 'Team Position')
|
||||||
)
|
)
|
||||||
->hidden(fn(Get $get) => $get('similar_past_matches') != 'none')
|
->hidden(fn (Get $get) => $get('similar_past_matches') != 'none')
|
||||||
->default('all')
|
->default('all')
|
||||||
->selectablePlaceholder(false)
|
->selectablePlaceholder(false)
|
||||||
->options([
|
->options([
|
||||||
@@ -296,21 +296,21 @@ class Statistic extends BaseDashboard
|
|||||||
->live()
|
->live()
|
||||||
// ->columnSpan(2)
|
// ->columnSpan(2)
|
||||||
->hiddenLabel()
|
->hiddenLabel()
|
||||||
->hidden(fn(Get $get) => $get('team_id') != null)
|
->hidden(fn (Get $get) => $get('team_id') != null)
|
||||||
->columnSpan(fn(Get $get) => $get('similar_past_matches') != 'none' ? 2 : 1)
|
->columnSpan(fn (Get $get) => $get('similar_past_matches') != 'none' ? 2 : 1)
|
||||||
->suffixAction(Action::make('reset')
|
->suffixAction(Action::make('reset')
|
||||||
->icon('phosphor-x-circle')
|
->icon('phosphor-x-circle')
|
||||||
->tooltip('Clear SMP')
|
->tooltip('Clear SMP')
|
||||||
->action(fn(callable $set) => $set('similar_past_matches', 'none'))
|
->action(fn (callable $set) => $set('similar_past_matches', 'none'))
|
||||||
->color(fn(Get $get): string => $get('similar_past_matches') != 'none' ? 'danger' : 'gray'))
|
->color(fn (Get $get): string => $get('similar_past_matches') != 'none' ? 'danger' : 'gray'))
|
||||||
->placeholder('Similar Past Matches')
|
->placeholder('Similar Past Matches')
|
||||||
->suffix(fn(Get $get): string|HtmlString => $get('similar_past_matches') != 'none' ? new HtmlString('<div class="text-center w-24 font-bold rounded p-1 bg-blue-600 dark:bg-blue-700 text-white dark:text-gray-300">± ' . $get('accuracy') . '</div>') : '')
|
->suffix(fn (Get $get): string|HtmlString => $get('similar_past_matches') != 'none' ? new HtmlString('<div class="text-center w-24 font-bold rounded p-1 bg-blue-600 dark:bg-blue-700 text-white dark:text-gray-300">± '.$get('accuracy').'</div>') : '')
|
||||||
->prefix('SPM')
|
->prefix('SPM')
|
||||||
->prefixAction(
|
->prefixAction(
|
||||||
Action::make('iconInfo')
|
Action::make('iconInfo')
|
||||||
->icon('phosphor-question')
|
->icon('phosphor-question')
|
||||||
->color(fn(Get $get): string => $get('similar_past_matches') != 'none' ? 'success' : 'danger')
|
->color(fn (Get $get): string => $get('similar_past_matches') != 'none' ? 'success' : 'danger')
|
||||||
->tooltip(fn() => $this->tooltip_similar_past_matches())
|
->tooltip(fn () => $this->tooltip_similar_past_matches())
|
||||||
)
|
)
|
||||||
->default('none')
|
->default('none')
|
||||||
->selectablePlaceholder(false)
|
->selectablePlaceholder(false)
|
||||||
@@ -330,7 +330,7 @@ class Statistic extends BaseDashboard
|
|||||||
Slider::make('accuracy')
|
Slider::make('accuracy')
|
||||||
->live()
|
->live()
|
||||||
->hiddenLabel()
|
->hiddenLabel()
|
||||||
->hidden(fn(Get $get) => $get('similar_past_matches') == 'none')
|
->hidden(fn (Get $get) => $get('similar_past_matches') == 'none')
|
||||||
->fillTrack()
|
->fillTrack()
|
||||||
->minValue(0)
|
->minValue(0)
|
||||||
->maxValue(0.25)
|
->maxValue(0.25)
|
||||||
@@ -350,13 +350,13 @@ class Statistic extends BaseDashboard
|
|||||||
->allowHtml()
|
->allowHtml()
|
||||||
->columnSpan(2)
|
->columnSpan(2)
|
||||||
->placeholder('Player')
|
->placeholder('Player')
|
||||||
->visible(fn(Get $get) => $get('team_id'))
|
->visible(fn (Get $get) => $get('team_id'))
|
||||||
->hidden(fn(Get $get) => $get('similar_past_matches') != 'none')
|
->hidden(fn (Get $get) => $get('similar_past_matches') != 'none')
|
||||||
->prefixIconColor(fn(Get $get): string => $get('similar_past_matches') == 'none' ? 'success' : '')
|
->prefixIconColor(fn (Get $get): string => $get('similar_past_matches') == 'none' ? 'success' : '')
|
||||||
->prefixIcon('icon-player')
|
->prefixIcon('icon-player')
|
||||||
->preload()
|
->preload()
|
||||||
->searchable()
|
->searchable()
|
||||||
->extraAttributes(fn() => [
|
->extraAttributes(fn () => [
|
||||||
'id' => 'player_selector',
|
'id' => 'player_selector',
|
||||||
'style' => 'width: 100%;',
|
'style' => 'width: 100%;',
|
||||||
])
|
])
|
||||||
@@ -364,7 +364,7 @@ class Statistic extends BaseDashboard
|
|||||||
Action::make('iconInfo')
|
Action::make('iconInfo')
|
||||||
->icon('phosphor-question')
|
->icon('phosphor-question')
|
||||||
->color('success')
|
->color('success')
|
||||||
->tooltip(fn() => $this->tooltip_player_info())
|
->tooltip(fn () => $this->tooltip_player_info())
|
||||||
)
|
)
|
||||||
->options(function (Get $get) {
|
->options(function (Get $get) {
|
||||||
$team_id = $get('team_id');
|
$team_id = $get('team_id');
|
||||||
@@ -381,7 +381,7 @@ class Statistic extends BaseDashboard
|
|||||||
->placeholder('Time on field')
|
->placeholder('Time on field')
|
||||||
->prefixIcon('phosphor-watch')
|
->prefixIcon('phosphor-watch')
|
||||||
->default('all')
|
->default('all')
|
||||||
->hidden(fn(Get $get) => ! $get('ss_player_id'))
|
->hidden(fn (Get $get) => ! $get('ss_player_id'))
|
||||||
->prefixIconColor('success')
|
->prefixIconColor('success')
|
||||||
->selectablePlaceholder(false)
|
->selectablePlaceholder(false)
|
||||||
->options([
|
->options([
|
||||||
@@ -402,7 +402,7 @@ class Statistic extends BaseDashboard
|
|||||||
->extraAttributes([
|
->extraAttributes([
|
||||||
'class' => 'radio-statistic-group',
|
'class' => 'radio-statistic-group',
|
||||||
])
|
])
|
||||||
->hidden(fn(Get $get) => $get('similar_past_matches') != 'none')
|
->hidden(fn (Get $get) => $get('similar_past_matches') != 'none')
|
||||||
->columnSpan(2)
|
->columnSpan(2)
|
||||||
->inline()
|
->inline()
|
||||||
->default('season')
|
->default('season')
|
||||||
@@ -421,8 +421,8 @@ class Statistic extends BaseDashboard
|
|||||||
->multiple()
|
->multiple()
|
||||||
->placeholder('Current Season')
|
->placeholder('Current Season')
|
||||||
->prefixIconColor('success')
|
->prefixIconColor('success')
|
||||||
->visible(fn(Get $get) => $get('seasonmode'))
|
->visible(fn (Get $get) => $get('seasonmode'))
|
||||||
->hidden(fn(Get $get) => $get('seasonmode') == 'halfyear' || $get('season_or_date') == 'date' || $get('similar_past_matches') != 'none')
|
->hidden(fn (Get $get) => $get('seasonmode') == 'halfyear' || $get('season_or_date') == 'date' || $get('similar_past_matches') != 'none')
|
||||||
->prefixIcon('phosphor-calendar-star')
|
->prefixIcon('phosphor-calendar-star')
|
||||||
->options([
|
->options([
|
||||||
'2026' => '2026',
|
'2026' => '2026',
|
||||||
@@ -442,8 +442,8 @@ class Statistic extends BaseDashboard
|
|||||||
->multiple()
|
->multiple()
|
||||||
->placeholder('Current Season')
|
->placeholder('Current Season')
|
||||||
->prefixIconColor('success')
|
->prefixIconColor('success')
|
||||||
->visible(fn(Get $get) => $get('seasonmode'))
|
->visible(fn (Get $get) => $get('seasonmode'))
|
||||||
->hidden(fn(Get $get) => $get('seasonmode') == 'fullyear' || $get('season_or_date') == 'date' || $get('similar_past_matches') != 'none')
|
->hidden(fn (Get $get) => $get('seasonmode') == 'fullyear' || $get('season_or_date') == 'date' || $get('similar_past_matches') != 'none')
|
||||||
->prefixIcon('phosphor-calendar-star')
|
->prefixIcon('phosphor-calendar-star')
|
||||||
->options([
|
->options([
|
||||||
'26/27' => '26/27',
|
'26/27' => '26/27',
|
||||||
@@ -459,46 +459,46 @@ class Statistic extends BaseDashboard
|
|||||||
DatePicker::make('start_date')
|
DatePicker::make('start_date')
|
||||||
->live()
|
->live()
|
||||||
->hiddenLabel()
|
->hiddenLabel()
|
||||||
->hidden(fn(Get $get) => $get('season_or_date') == 'season')
|
->hidden(fn (Get $get) => $get('season_or_date') == 'season')
|
||||||
->native(false)
|
->native(false)
|
||||||
->prefixIconColor(fn(Get $get): string => $get('start_date') ? 'success' : 'primary')
|
->prefixIconColor(fn (Get $get): string => $get('start_date') ? 'success' : 'primary')
|
||||||
->prefixIcon('phosphor-calendar')
|
->prefixIcon('phosphor-calendar')
|
||||||
->prefix('Start')
|
->prefix('Start')
|
||||||
->suffixAction(
|
->suffixAction(
|
||||||
Action::make('clear_start')
|
Action::make('clear_start')
|
||||||
->icon('phosphor-x')
|
->icon('phosphor-x')
|
||||||
->color('gray')
|
->color('gray')
|
||||||
->action(fn(Set $set) => $set('start_date', null))
|
->action(fn (Set $set) => $set('start_date', null))
|
||||||
),
|
),
|
||||||
DatePicker::make('end_date')
|
DatePicker::make('end_date')
|
||||||
->live()
|
->live()
|
||||||
->hiddenLabel()
|
->hiddenLabel()
|
||||||
->hidden(fn(Get $get) => $get('season_or_date') == 'season')
|
->hidden(fn (Get $get) => $get('season_or_date') == 'season')
|
||||||
->native(false)
|
->native(false)
|
||||||
->prefixIconColor(fn(Get $get): string => $get('end_date') ? 'success' : 'primary')
|
->prefixIconColor(fn (Get $get): string => $get('end_date') ? 'success' : 'primary')
|
||||||
->prefixIcon('phosphor-calendar')
|
->prefixIcon('phosphor-calendar')
|
||||||
->prefix('End')
|
->prefix('End')
|
||||||
->suffixAction(
|
->suffixAction(
|
||||||
Action::make('clear_end')
|
Action::make('clear_end')
|
||||||
->icon('phosphor-x')
|
->icon('phosphor-x')
|
||||||
->color('gray')
|
->color('gray')
|
||||||
->action(fn(Set $set) => $set('end_date', null))
|
->action(fn (Set $set) => $set('end_date', null))
|
||||||
),
|
),
|
||||||
Actions::make([
|
Actions::make([
|
||||||
Action::make('esc')
|
Action::make('esc')
|
||||||
->hiddenLabel()
|
->hiddenLabel()
|
||||||
->hidden(fn(Get $get) => $get('similar_past_matches') != 'none')
|
->hidden(fn (Get $get) => $get('similar_past_matches') != 'none')
|
||||||
->tooltip('Clear All (esc)')
|
->tooltip('Clear All (esc)')
|
||||||
->icon('phosphor-x-circle')
|
->icon('phosphor-x-circle')
|
||||||
->color(fn(Get $get) => $get('sofascore_category_id') ? 'danger' : 'gray')
|
->color(fn (Get $get) => $get('sofascore_category_id') ? 'danger' : 'gray')
|
||||||
->keyBindings(['esc'])
|
->keyBindings(['esc'])
|
||||||
->outlined()
|
->outlined()
|
||||||
->size(Size::Medium)
|
->size(Size::Medium)
|
||||||
->action('resetFilters'),
|
->action('resetFilters'),
|
||||||
Action::make('copy')
|
Action::make('copy')
|
||||||
->hiddenLabel()
|
->hiddenLabel()
|
||||||
->hidden(fn(Get $get) => $get('similar_past_matches') != 'none')
|
->hidden(fn (Get $get) => $get('similar_past_matches') != 'none')
|
||||||
->visible(fn(Get $get) => $get('team_id'))
|
->visible(fn (Get $get) => $get('team_id'))
|
||||||
->tooltip('Copy data for pasting into spreadsheet')
|
->tooltip('Copy data for pasting into spreadsheet')
|
||||||
->color('success')
|
->color('success')
|
||||||
->size(Size::Medium)
|
->size(Size::Medium)
|
||||||
@@ -521,12 +521,15 @@ class Statistic extends BaseDashboard
|
|||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Summary of generateDynamicPayload
|
||||||
|
*/
|
||||||
public function generateDynamicPayload(): string
|
public function generateDynamicPayload(): string
|
||||||
{
|
{
|
||||||
$data = LoadEventsBoxes::load($this->filters, false);
|
$data = LoadEventsBoxes::load($this->filters, false);
|
||||||
|
|
||||||
$header = ['Team', 'Event', 'Odd 1', 'Odd X', 'Odd 2', 'Category', 'EXP H', 'EXP A', 'AGV+', 'AGV-', 'AGV Team Season H', 'AGV Team Season A', 'AGV League H', 'AGV League A'];
|
$header = ['Team', 'Event', 'Odd 1', 'Odd X', 'Odd 2', 'Category', 'EXP H', 'EXP A', 'AGV+', 'AGV-', 'AGV Team Season H', 'AGV Team Season A', 'AGV League H', 'AGV League A'];
|
||||||
$copystring = implode(';', $header) . "\n";
|
$copystring = implode(';', $header)."\n";
|
||||||
$row = [];
|
$row = [];
|
||||||
$row[] = $data['active_team'];
|
$row[] = $data['active_team'];
|
||||||
$row[] = $data['count_events'];
|
$row[] = $data['count_events'];
|
||||||
@@ -542,7 +545,7 @@ class Statistic extends BaseDashboard
|
|||||||
$row[] = $data['gls_team_season']['away'];
|
$row[] = $data['gls_team_season']['away'];
|
||||||
$row[] = $data['gls_liga_season']['home'];
|
$row[] = $data['gls_liga_season']['home'];
|
||||||
$row[] = $data['gls_liga_season']['away'];
|
$row[] = $data['gls_liga_season']['away'];
|
||||||
$copystring .= implode(';', $row) . "\n";
|
$copystring .= implode(';', $row)."\n";
|
||||||
$row = [];
|
$row = [];
|
||||||
$row = array_fill(0, 5, '');
|
$row = array_fill(0, 5, '');
|
||||||
$row[] = 'Fouls';
|
$row[] = 'Fouls';
|
||||||
@@ -554,7 +557,7 @@ class Statistic extends BaseDashboard
|
|||||||
$row[] = $data['fls_team_season']['away'];
|
$row[] = $data['fls_team_season']['away'];
|
||||||
$row[] = $data['fls_liga_season']['home'];
|
$row[] = $data['fls_liga_season']['home'];
|
||||||
$row[] = $data['fls_liga_season']['away'];
|
$row[] = $data['fls_liga_season']['away'];
|
||||||
$copystring .= implode(';', $row) . "\n";
|
$copystring .= implode(';', $row)."\n";
|
||||||
$row = [];
|
$row = [];
|
||||||
$row = array_fill(0, 5, '');
|
$row = array_fill(0, 5, '');
|
||||||
$row[] = 'Offside';
|
$row[] = 'Offside';
|
||||||
@@ -566,7 +569,7 @@ class Statistic extends BaseDashboard
|
|||||||
$row[] = $data['ofs_team_season']['away'];
|
$row[] = $data['ofs_team_season']['away'];
|
||||||
$row[] = $data['ofs_liga_season']['home'];
|
$row[] = $data['ofs_liga_season']['home'];
|
||||||
$row[] = $data['ofs_liga_season']['away'];
|
$row[] = $data['ofs_liga_season']['away'];
|
||||||
$copystring .= implode(';', $row) . "\n";
|
$copystring .= implode(';', $row)."\n";
|
||||||
$row = [];
|
$row = [];
|
||||||
$row = array_fill(0, 5, '');
|
$row = array_fill(0, 5, '');
|
||||||
$row[] = 'Cards';
|
$row[] = 'Cards';
|
||||||
@@ -578,7 +581,7 @@ class Statistic extends BaseDashboard
|
|||||||
$row[] = $data['crd_team_season']['away'];
|
$row[] = $data['crd_team_season']['away'];
|
||||||
$row[] = $data['crd_liga_season']['home'];
|
$row[] = $data['crd_liga_season']['home'];
|
||||||
$row[] = $data['crd_liga_season']['away'];
|
$row[] = $data['crd_liga_season']['away'];
|
||||||
$copystring .= implode(';', $row) . "\n";
|
$copystring .= implode(';', $row)."\n";
|
||||||
$row = [];
|
$row = [];
|
||||||
$row = array_fill(0, 5, '');
|
$row = array_fill(0, 5, '');
|
||||||
$row[] = 'Shots on traget';
|
$row[] = 'Shots on traget';
|
||||||
@@ -590,7 +593,7 @@ class Statistic extends BaseDashboard
|
|||||||
$row[] = $data['snt_team_season']['away'];
|
$row[] = $data['snt_team_season']['away'];
|
||||||
$row[] = $data['snt_liga_season']['home'];
|
$row[] = $data['snt_liga_season']['home'];
|
||||||
$row[] = $data['snt_liga_season']['away'];
|
$row[] = $data['snt_liga_season']['away'];
|
||||||
$copystring .= implode(';', $row) . "\n";
|
$copystring .= implode(';', $row)."\n";
|
||||||
$row = [];
|
$row = [];
|
||||||
$row = array_fill(0, 5, '');
|
$row = array_fill(0, 5, '');
|
||||||
$row[] = 'Total Shots';
|
$row[] = 'Total Shots';
|
||||||
@@ -602,7 +605,7 @@ class Statistic extends BaseDashboard
|
|||||||
$row[] = $data['tsh_team_season']['away'];
|
$row[] = $data['tsh_team_season']['away'];
|
||||||
$row[] = $data['tsh_liga_season']['home'];
|
$row[] = $data['tsh_liga_season']['home'];
|
||||||
$row[] = $data['tsh_liga_season']['away'];
|
$row[] = $data['tsh_liga_season']['away'];
|
||||||
$copystring .= implode(';', $row) . "\n";
|
$copystring .= implode(';', $row)."\n";
|
||||||
|
|
||||||
return $copystring;
|
return $copystring;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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\Charts\LoadEvents\LoadEventsQueryAll;
|
use App\Filament\Widgets\Charts\LoadEvents\LoadEventsQueryAll;
|
||||||
use App\Utilities\Round;
|
use App\Utilities\Round;
|
||||||
|
use Illuminate\Support\Facades\Log;
|
||||||
|
|
||||||
class ExpectationsTeam
|
class ExpectationsTeam
|
||||||
{
|
{
|
||||||
@@ -29,20 +30,24 @@ class ExpectationsTeam
|
|||||||
}
|
}
|
||||||
|
|
||||||
$res = LoadEventsQueryAll::load($filter, $match);
|
$res = LoadEventsQueryAll::load($filter, $match);
|
||||||
|
|
||||||
$count_events = $res->count();
|
$count_events = $res->count();
|
||||||
if (! $res) {
|
if (! $res) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
$tmp = [];
|
$tmp = [];
|
||||||
foreach ($res as $value) {
|
foreach ($res as $value) {
|
||||||
ExpectationCollecting::sort($tmp, 'gls', $value->home_id, $value->away_id, $value->gls_h, $value->gls_a, $match);
|
ExpectationCollecting::sort($similar_past_matches, $tmp, 'gls', $value->home_id, $value->away_id, $value->gls_h, $value->gls_a, $match);
|
||||||
ExpectationCollecting::sort($tmp, 'fls', $value->home_id, $value->away_id, $value->fls_h, $value->fls_a, $match);
|
ExpectationCollecting::sort($similar_past_matches, $tmp, 'fls', $value->home_id, $value->away_id, $value->fls_h, $value->fls_a, $match);
|
||||||
ExpectationCollecting::sort($tmp, 'ofs', $value->home_id, $value->away_id, $value->ofs_h, $value->ofs_a, $match);
|
ExpectationCollecting::sort($similar_past_matches, $tmp, 'ofs', $value->home_id, $value->away_id, $value->ofs_h, $value->ofs_a, $match);
|
||||||
ExpectationCollecting::sort($tmp, 'crd', $value->home_id, $value->away_id, $value->crd_h, $value->crd_a, $match);
|
ExpectationCollecting::sort($similar_past_matches, $tmp, 'crd', $value->home_id, $value->away_id, $value->crd_h, $value->crd_a, $match);
|
||||||
ExpectationCollecting::sort($tmp, 'snt', $value->home_id, $value->away_id, $value->snt_h, $value->snt_a, $match);
|
ExpectationCollecting::sort($similar_past_matches, $tmp, 'snt', $value->home_id, $value->away_id, $value->snt_h, $value->snt_a, $match);
|
||||||
ExpectationCollecting::sort($tmp, 'tsh', $value->home_id, $value->away_id, $value->tsh_h, $value->tsh_a, $match);
|
ExpectationCollecting::sort($similar_past_matches, $tmp, 'tsh', $value->home_id, $value->away_id, $value->tsh_h, $value->tsh_a, $match);
|
||||||
ExpectationCollecting::sort($tmp, 'crn', $value->home_id, $value->away_id, $value->crn_h, $value->crn_a, $match);
|
ExpectationCollecting::sort($similar_past_matches, $tmp, 'crn', $value->home_id, $value->away_id, $value->crn_h, $value->crn_a, $match);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Log::debug('expectations '.$count_events, $tmp);
|
||||||
|
|
||||||
$expectations = ExpectationCalculation::calc($tmp);
|
$expectations = ExpectationCalculation::calc($tmp);
|
||||||
$expectations['gls']['name'] = 'Goals';
|
$expectations['gls']['name'] = 'Goals';
|
||||||
$expectations['fls']['name'] = 'Fouls';
|
$expectations['fls']['name'] = 'Fouls';
|
||||||
@@ -53,6 +58,8 @@ class ExpectationsTeam
|
|||||||
$expectations['home'] = $home_team;
|
$expectations['home'] = $home_team;
|
||||||
$expectations['away'] = $away_team;
|
$expectations['away'] = $away_team;
|
||||||
|
|
||||||
|
// Log::debug('expectations '.$count_events, $expectations);
|
||||||
|
|
||||||
$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 as $value) {
|
||||||
if ($team_id && $team_position == 'home') {
|
if ($team_id && $team_position == 'home') {
|
||||||
|
|||||||
@@ -4,43 +4,47 @@ namespace App\Filament\Widgets\Boxes\Helper;
|
|||||||
|
|
||||||
class ExpectationCollecting
|
class ExpectationCollecting
|
||||||
{
|
{
|
||||||
public static function sort(array &$result, string $type, int $home_id, int $away_id, float $val_home, float $val_away, object $match)
|
public static function sort(string $similar_past_matches, array &$result, string $type, int $home_id, int $away_id, float $val_home, float $val_away, object $match)
|
||||||
{
|
{
|
||||||
|
if ($similar_past_matches != 'none') {
|
||||||
if ($home_id == $match->home_id) {
|
|
||||||
$result[$type.'_home_made_total'][] = $val_home;
|
$result[$type.'_home_made_total'][] = $val_home;
|
||||||
$result[$type.'_home_made_home'][] = $val_home;
|
$result[$type.'_away_made_total'][] = $val_away;
|
||||||
$result[$type.'_home_got_total'][] = $val_away;
|
} else {
|
||||||
$result[$type.'_home_got_home'][] = $val_away;
|
if ($home_id == $match->home_id) {
|
||||||
} elseif ($away_id == $match->home_id) {
|
$result[$type.'_home_made_total'][] = $val_home;
|
||||||
$result[$type.'_home_made_total'][] = $val_away;
|
$result[$type.'_home_made_home'][] = $val_home;
|
||||||
$result[$type.'_home_got_total'][] = $val_away;
|
$result[$type.'_home_got_total'][] = $val_away;
|
||||||
} elseif ($home_id == $match->away_id) {
|
$result[$type.'_home_got_home'][] = $val_away;
|
||||||
$result[$type.'_home_made_total'][] = $val_away;
|
} elseif ($away_id == $match->home_id) {
|
||||||
$result[$type.'_home_got_total'][] = $val_away;
|
$result[$type.'_home_made_total'][] = $val_away;
|
||||||
} elseif ($away_id == $match->away_id) {
|
$result[$type.'_home_got_total'][] = $val_away;
|
||||||
$result[$type.'_home_made_total'][] = $val_home;
|
} elseif ($home_id == $match->away_id) {
|
||||||
$result[$type.'_home_made_home'][] = $val_home;
|
$result[$type.'_home_made_total'][] = $val_away;
|
||||||
$result[$type.'_home_got_total'][] = $val_away;
|
$result[$type.'_home_got_total'][] = $val_away;
|
||||||
$result[$type.'_home_got_home'][] = $val_home;
|
} elseif ($away_id == $match->away_id) {
|
||||||
}
|
$result[$type.'_home_made_total'][] = $val_home;
|
||||||
|
$result[$type.'_home_made_home'][] = $val_home;
|
||||||
|
$result[$type.'_home_got_total'][] = $val_away;
|
||||||
|
$result[$type.'_home_got_home'][] = $val_home;
|
||||||
|
}
|
||||||
|
|
||||||
if ($away_id == $match->away_id) {
|
if ($away_id == $match->away_id) {
|
||||||
$result[$type.'_away_made_total'][] = $val_away;
|
$result[$type.'_away_made_total'][] = $val_away;
|
||||||
$result[$type.'_away_made_home'][] = $val_away;
|
$result[$type.'_away_made_home'][] = $val_away;
|
||||||
$result[$type.'_away_got_total'][] = $val_home;
|
$result[$type.'_away_got_total'][] = $val_home;
|
||||||
$result[$type.'_away_got_home'][] = $val_home;
|
$result[$type.'_away_got_home'][] = $val_home;
|
||||||
} elseif ($home_id == $match->away_id) {
|
} elseif ($home_id == $match->away_id) {
|
||||||
$result[$type.'_away_made_total'][] = $val_home;
|
$result[$type.'_away_made_total'][] = $val_home;
|
||||||
$result[$type.'_away_got_total'][] = $val_home;
|
$result[$type.'_away_got_total'][] = $val_home;
|
||||||
} elseif ($away_id == $match->home_id) {
|
} elseif ($away_id == $match->home_id) {
|
||||||
$result[$type.'_away_made_total'][] = $val_home;
|
$result[$type.'_away_made_total'][] = $val_home;
|
||||||
$result[$type.'_away_got_total'][] = $val_home;
|
$result[$type.'_away_got_total'][] = $val_home;
|
||||||
} elseif ($home_id == $match->home_id) {
|
} elseif ($home_id == $match->home_id) {
|
||||||
$result[$type.'_away_made_total'][] = $val_away;
|
$result[$type.'_away_made_total'][] = $val_away;
|
||||||
$result[$type.'_away_made_home'][] = $val_away;
|
$result[$type.'_away_made_home'][] = $val_away;
|
||||||
$result[$type.'_away_got_total'][] = $val_home;
|
$result[$type.'_away_got_total'][] = $val_home;
|
||||||
$result[$type.'_away_got_home'][] = $val_away;
|
$result[$type.'_away_got_home'][] = $val_away;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -15,6 +15,7 @@ class BoxesBettypeAll extends StatsOverviewWidget
|
|||||||
{
|
{
|
||||||
use InteractsWithPageFilters;
|
use InteractsWithPageFilters;
|
||||||
|
|
||||||
|
// Within your Widget class:
|
||||||
protected ?string $pollingInterval = null;
|
protected ?string $pollingInterval = null;
|
||||||
|
|
||||||
protected int|array|null $columns = null;
|
protected int|array|null $columns = null;
|
||||||
@@ -33,6 +34,8 @@ class BoxesBettypeAll extends StatsOverviewWidget
|
|||||||
{
|
{
|
||||||
$data = LoadEventsBoxes::load($this->filters, false);
|
$data = LoadEventsBoxes::load($this->filters, false);
|
||||||
|
|
||||||
|
// dd($data);
|
||||||
|
|
||||||
$similar_past_matches = $this->filters['similar_past_matches'];
|
$similar_past_matches = $this->filters['similar_past_matches'];
|
||||||
$team_position = $this->filters['team_position'];
|
$team_position = $this->filters['team_position'];
|
||||||
|
|
||||||
@@ -48,7 +51,7 @@ class BoxesBettypeAll extends StatsOverviewWidget
|
|||||||
$count_events = $data['count_events'];
|
$count_events = $data['count_events'];
|
||||||
$boxes = [];
|
$boxes = [];
|
||||||
$boxes[] = Stat::make('Total', self::template_total($count_events))
|
$boxes[] = Stat::make('Total', self::template_total($count_events))
|
||||||
->description(fn() => $similar_past_matches == 'none' ? 'Team Selected' : 'Similar Past Matches')
|
->description(fn () => $similar_past_matches == 'none' ? 'Team Selected' : 'Similar Past Matches')
|
||||||
->extraAttributes(['x-init' => "animate('number-of-events', $count_events);", 'class' => 'box-success justify-center']);
|
->extraAttributes(['x-init' => "animate('number-of-events', $count_events);", 'class' => 'box-success justify-center']);
|
||||||
|
|
||||||
// BOX 1X2
|
// BOX 1X2
|
||||||
@@ -68,22 +71,22 @@ class BoxesBettypeAll extends StatsOverviewWidget
|
|||||||
|
|
||||||
// BOX AVERAGE
|
// BOX AVERAGE
|
||||||
if (isset($data['gls_team'])) {
|
if (isset($data['gls_team'])) {
|
||||||
$boxes[] = Stat::make('Average ' . $data['active_team'], self::template_tabelle_2($data))
|
$boxes[] = Stat::make('Average '.$data['active_team'], self::template_tabelle_2($data))
|
||||||
->extraAttributes(['class' => 'box-blank'])
|
->extraAttributes(['class' => 'box-blank'])
|
||||||
->description($team_position);
|
->description($team_position);
|
||||||
}
|
}
|
||||||
|
|
||||||
// BOX AVERAGE WITH TEAM FIXED TO ACTIVE SEASON
|
// BOX AVERAGE WITH TEAM FIXED TO ACTIVE SEASON
|
||||||
if (isset($data['gls_team_season'])) {
|
if (isset($data['gls_team_season'])) {
|
||||||
$boxes[] = Stat::make('Average ' . $data['active_team'], self::template_tabelle_3($data))
|
$boxes[] = Stat::make('Average '.$data['active_team'], self::template_tabelle_3($data))
|
||||||
->extraAttributes(['class' => 'box-blank'])
|
->extraAttributes(['class' => 'box-blank'])
|
||||||
->description('Season ' . $data['active_season']);
|
->description('Season '.$data['active_season']);
|
||||||
}
|
}
|
||||||
// BOX AVERAGE ALL LEAGUE FIXED TO ACTIVE SEASON
|
// BOX AVERAGE ALL LEAGUE FIXED TO ACTIVE SEASON
|
||||||
if (isset($data['gls_liga_season'])) {
|
if (isset($data['gls_liga_season'])) {
|
||||||
$boxes[] = Stat::make('League Average', self::template_tabelle_4($data))
|
$boxes[] = Stat::make('League Average', self::template_tabelle_4($data))
|
||||||
->extraAttributes(['class' => 'box-blank'])
|
->extraAttributes(['class' => 'box-blank'])
|
||||||
->description('Season ' . $data['active_season']);
|
->description('Season '.$data['active_season']);
|
||||||
}
|
}
|
||||||
|
|
||||||
$this->columns = [
|
$this->columns = [
|
||||||
@@ -100,7 +103,7 @@ class BoxesBettypeAll extends StatsOverviewWidget
|
|||||||
protected function template_total(float $total_home): HtmlString
|
protected function template_total(float $total_home): HtmlString
|
||||||
{
|
{
|
||||||
return new HtmlString('<div class="grid grid-cols-1 justify-center font-bold text-2xl">
|
return new HtmlString('<div class="grid grid-cols-1 justify-center font-bold text-2xl">
|
||||||
<span class="text-center" id="number-of-events">' . $total_home . '</span>
|
<span class="text-center" id="number-of-events">'.$total_home.'</span>
|
||||||
<span class="text-center text-xs text-gray-500 dark:text-gray-400">Events</span>
|
<span class="text-center text-xs text-gray-500 dark:text-gray-400">Events</span>
|
||||||
</div>');
|
</div>');
|
||||||
}
|
}
|
||||||
@@ -109,22 +112,22 @@ class BoxesBettypeAll extends StatsOverviewWidget
|
|||||||
protected function template_odds(array &$data, float $win, float $draw, float $lost): HtmlString
|
protected function template_odds(array &$data, float $win, float $draw, float $lost): HtmlString
|
||||||
{
|
{
|
||||||
if ($this->filters['similar_past_matches'] != 'none') {
|
if ($this->filters['similar_past_matches'] != 'none') {
|
||||||
$name_win = '<b>1</b> (' . $data['win_count'] . ')';
|
$name_win = '<b>1</b> ('.$data['win_count'].')';
|
||||||
$name_draw = '<b>X</b> (' . $data['draw_count'] . ')';
|
$name_draw = '<b>X</b> ('.$data['draw_count'].')';
|
||||||
$name_lost = '<b>2</b> (' . $data['lost_count'] . ')';
|
$name_lost = '<b>2</b> ('.$data['lost_count'].')';
|
||||||
} else {
|
} else {
|
||||||
$name_win = '<b>Win</b> (' . $data['win_count'] . ')';
|
$name_win = '<b>Win</b> ('.$data['win_count'].')';
|
||||||
$name_draw = '<b>Draw</b> (' . $data['draw_count'] . ')';
|
$name_draw = '<b>Draw</b> ('.$data['draw_count'].')';
|
||||||
$name_lost = '<b>Lost</b> (' . $data['lost_count'] . ')';
|
$name_lost = '<b>Lost</b> ('.$data['lost_count'].')';
|
||||||
}
|
}
|
||||||
|
|
||||||
return new HtmlString('<div class="grid grid-cols-3 gap-3">
|
return new HtmlString('<div class="grid grid-cols-3 gap-3">
|
||||||
<span class="text-center font-bold text-xl" id="win">' . number_format($win, 2) . '</span>
|
<span class="text-center font-bold text-xl" id="win">'.number_format($win, 2).'</span>
|
||||||
<span class="text-center font-bold text-xl" id="draw">' . number_format($draw, 2) . '</span>
|
<span class="text-center font-bold text-xl" id="draw">'.number_format($draw, 2).'</span>
|
||||||
<span class="text-center font-bold text-xl" id="lost">' . number_format($lost, 2) . '</span>
|
<span class="text-center font-bold text-xl" id="lost">'.number_format($lost, 2).'</span>
|
||||||
<span class="text-center text-xs text-gray-500 dark:text-gray-400">' . $name_win . '</span>
|
<span class="text-center text-xs text-gray-500 dark:text-gray-400">'.$name_win.'</span>
|
||||||
<span class="text-center text-xs text-gray-500 dark:text-gray-400">' . $name_draw . '</span>
|
<span class="text-center text-xs text-gray-500 dark:text-gray-400">'.$name_draw.'</span>
|
||||||
<span class="text-center text-xs text-gray-500 dark:text-gray-400">' . $name_lost . '</span>
|
<span class="text-center text-xs text-gray-500 dark:text-gray-400">'.$name_lost.'</span>
|
||||||
</div>');
|
</div>');
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -135,9 +138,9 @@ class BoxesBettypeAll extends StatsOverviewWidget
|
|||||||
$str = '<div class="grid grid-cols-4 gap-0.5 text-xs">';
|
$str = '<div class="grid grid-cols-4 gap-0.5 text-xs">';
|
||||||
// $str .= '<div class="col-span-2"></div><div>Home</div><div>Away</div>';
|
// $str .= '<div class="col-span-2"></div><div>Home</div><div>Away</div>';
|
||||||
foreach ($bets as $name) {
|
foreach ($bets as $name) {
|
||||||
$str .= '<div class="font-normal text-left col-span-2">' . $data[$name]['name'] . '</div>';
|
$str .= '<div class="font-normal text-left col-span-2">'.$data[$name]['name'].'</div>';
|
||||||
$str .= '<div class="text-right">' . number_format($data[$name]['home'], 1) . '</div>';
|
$str .= '<div class="text-right">'.number_format($data[$name]['home'], 1).'</div>';
|
||||||
$str .= '<div class="text-right">' . number_format($data[$name]['away'], 1) . '</div>';
|
$str .= '<div class="text-right">'.number_format($data[$name]['away'], 1).'</div>';
|
||||||
}
|
}
|
||||||
$str .= '</div>';
|
$str .= '</div>';
|
||||||
|
|
||||||
@@ -150,9 +153,9 @@ class BoxesBettypeAll extends StatsOverviewWidget
|
|||||||
$str = '<div class="grid grid-cols-4 gap-0.5 text-xs">';
|
$str = '<div class="grid grid-cols-4 gap-0.5 text-xs">';
|
||||||
// $str .= '<div class="col-span-2"></div><div>Home</div><div>Away</div>';
|
// $str .= '<div class="col-span-2"></div><div>Home</div><div>Away</div>';
|
||||||
foreach ($bets as $name) {
|
foreach ($bets as $name) {
|
||||||
$str .= '<div class="font-normal text-left col-span-2">' . $data[$name]['name'] . '</div>';
|
$str .= '<div class="font-normal text-left col-span-2">'.$data[$name]['name'].'</div>';
|
||||||
$str .= '<div class="text-right">' . number_format($data[$name]['home'], 1) . '</div>';
|
$str .= '<div class="text-right">'.number_format($data[$name]['home'], 1).'</div>';
|
||||||
$str .= '<div class="text-right">' . number_format($data[$name]['away'], 1) . '</div>';
|
$str .= '<div class="text-right">'.number_format($data[$name]['away'], 1).'</div>';
|
||||||
}
|
}
|
||||||
$str .= '</div>';
|
$str .= '</div>';
|
||||||
|
|
||||||
@@ -165,9 +168,9 @@ class BoxesBettypeAll extends StatsOverviewWidget
|
|||||||
$str = '<div class="grid grid-cols-4 gap-0.5 text-xs">';
|
$str = '<div class="grid grid-cols-4 gap-0.5 text-xs">';
|
||||||
// $str .= '<div class="col-span-2"></div><div>Home</div><div>Away</div>';
|
// $str .= '<div class="col-span-2"></div><div>Home</div><div>Away</div>';
|
||||||
foreach ($bets as $name) {
|
foreach ($bets as $name) {
|
||||||
$str .= '<div class="font-normal text-left col-span-2">' . $data[$name]['name'] . '</div>';
|
$str .= '<div class="font-normal text-left col-span-2">'.$data[$name]['name'].'</div>';
|
||||||
$str .= '<div class="text-right">' . number_format($data[$name]['home'], 1) . '</div>';
|
$str .= '<div class="text-right">'.number_format($data[$name]['home'], 1).'</div>';
|
||||||
$str .= '<div class="text-right">' . number_format($data[$name]['away'], 1) . '</div>';
|
$str .= '<div class="text-right">'.number_format($data[$name]['away'], 1).'</div>';
|
||||||
}
|
}
|
||||||
$str .= '</div>';
|
$str .= '</div>';
|
||||||
|
|
||||||
@@ -180,9 +183,9 @@ class BoxesBettypeAll extends StatsOverviewWidget
|
|||||||
$str = '<div class="grid grid-cols-4 gap-0.5 text-xs">';
|
$str = '<div class="grid grid-cols-4 gap-0.5 text-xs">';
|
||||||
// $str .= '<div class="col-span-2"></div><div>Home</div><div>Away</div>';
|
// $str .= '<div class="col-span-2"></div><div>Home</div><div>Away</div>';
|
||||||
foreach ($bets as $name) {
|
foreach ($bets as $name) {
|
||||||
$str .= '<div class="font-normal text-left col-span-2">' . $data[$name]['name'] . '</div>';
|
$str .= '<div class="font-normal text-left col-span-2">'.$data[$name]['name'].'</div>';
|
||||||
$str .= '<div class="text-right">' . number_format($data[$name]['home'], 1) . '</div>';
|
$str .= '<div class="text-right">'.number_format($data[$name]['home'], 1).'</div>';
|
||||||
$str .= '<div class="text-right">' . number_format($data[$name]['away'], 1) . '</div>';
|
$str .= '<div class="text-right">'.number_format($data[$name]['away'], 1).'</div>';
|
||||||
}
|
}
|
||||||
$str .= '</div>';
|
$str .= '</div>';
|
||||||
|
|
||||||
|
|||||||
@@ -6,7 +6,6 @@ use App\Filament\Pages\Selections\Helper\GetSeason;
|
|||||||
use App\Models\SofaScoreRosa;
|
use App\Models\SofaScoreRosa;
|
||||||
use App\Models\StatistikoEvent;
|
use App\Models\StatistikoEvent;
|
||||||
use App\Models\StatistikoPlayer;
|
use App\Models\StatistikoPlayer;
|
||||||
use Illuminate\Support\Facades\Log;
|
|
||||||
|
|
||||||
class LoadEventsQuery
|
class LoadEventsQuery
|
||||||
{
|
{
|
||||||
@@ -137,10 +136,6 @@ class LoadEventsQuery
|
|||||||
->orderBy('starttime', 'ASC')
|
->orderBy('starttime', 'ASC')
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
// dd($res);
|
|
||||||
// dd($season, $league_id, $res);
|
|
||||||
Log::info('season', $season);
|
|
||||||
|
|
||||||
$arr = [];
|
$arr = [];
|
||||||
foreach ($res as $value) {
|
foreach ($res as $value) {
|
||||||
|
|
||||||
|
|||||||
@@ -33,6 +33,7 @@ class LoadEventsQueryAll
|
|||||||
$total_range = [];
|
$total_range = [];
|
||||||
if ($similar_past_matches != 'none') {
|
if ($similar_past_matches != 'none') {
|
||||||
$team_id = 0;
|
$team_id = 0;
|
||||||
|
$ss_player_id = 0;
|
||||||
$team_position = '';
|
$team_position = '';
|
||||||
$exp_handicap = $match->exp_away - $match->exp_home;
|
$exp_handicap = $match->exp_away - $match->exp_home;
|
||||||
$exp_total = $match->exp_away + $match->exp_home;
|
$exp_total = $match->exp_away + $match->exp_home;
|
||||||
@@ -40,12 +41,6 @@ class LoadEventsQueryAll
|
|||||||
$total_range = [$exp_total - $accuracy, $exp_total + $accuracy];
|
$total_range = [$exp_total - $accuracy, $exp_total + $accuracy];
|
||||||
}
|
}
|
||||||
|
|
||||||
if ($similar_past_matches != 'none') {
|
|
||||||
$team_position = '';
|
|
||||||
$team_id = 0;
|
|
||||||
$ss_player_id = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
// dd($season);
|
// dd($season);
|
||||||
$season = GetSeason::load($season, $seasonmode);
|
$season = GetSeason::load($season, $seasonmode);
|
||||||
|
|
||||||
@@ -98,6 +93,8 @@ class LoadEventsQueryAll
|
|||||||
/**
|
/**
|
||||||
* STATTISTIC DATA
|
* STATTISTIC DATA
|
||||||
*/
|
*/
|
||||||
|
// Log::debug('result', [$similar_past_matches, $home_id, $away_id, $team_id]);
|
||||||
|
|
||||||
return StatistikoEvent::with('home')->with('away')
|
return StatistikoEvent::with('home')->with('away')
|
||||||
->where(function ($query) use ($league_id, $similar_past_matches) {
|
->where(function ($query) use ($league_id, $similar_past_matches) {
|
||||||
switch ($similar_past_matches) {
|
switch ($similar_past_matches) {
|
||||||
|
|||||||
@@ -0,0 +1,141 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
namespace App\Filament\Widgets\Charts\LoadEvents;
|
||||||
|
|
||||||
|
use App\Filament\Pages\Selections\Helper\GetSeason;
|
||||||
|
use App\Models\StatistikoEvent;
|
||||||
|
use App\Models\StatistikoPlayer;
|
||||||
|
|
||||||
|
class LoadEventsQuerySPM
|
||||||
|
{
|
||||||
|
public static function load(array $filter, object $match)
|
||||||
|
{
|
||||||
|
$league_id = (int) $filter['league_id'] ?? 0;
|
||||||
|
$team_id = (int) $filter['team_id'] ?? 0;
|
||||||
|
$season = $filter['season'];
|
||||||
|
$seasonmode = $filter['seasonmode'];
|
||||||
|
$season_or_date = $filter['season_or_date'];
|
||||||
|
$accuracy = (float) $filter['accuracy'] ?? 0.5;
|
||||||
|
$start = $filter['start_date'] ?? 0;
|
||||||
|
$end = $filter['end_date'] ?? 0;
|
||||||
|
if ($season_or_date == 'season') {
|
||||||
|
$start = 0;
|
||||||
|
$end = 0;
|
||||||
|
}
|
||||||
|
$ss_player_id = (int) $filter['ss_player_id'] ?? 0;
|
||||||
|
$player_on_field = $filter['player_on_field'] ?? 'all';
|
||||||
|
$similar_past_matches = $filter['similar_past_matches'];
|
||||||
|
$team_position = $filter['team_position'];
|
||||||
|
$home_id = $match->home_id;
|
||||||
|
$away_id = $match->away_id;
|
||||||
|
|
||||||
|
$handicap_range = [];
|
||||||
|
$total_range = [];
|
||||||
|
if ($similar_past_matches != 'none') {
|
||||||
|
$team_id = 0;
|
||||||
|
$ss_player_id = 0;
|
||||||
|
$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];
|
||||||
|
}
|
||||||
|
|
||||||
|
// dd($season);
|
||||||
|
$season = GetSeason::load($season, $seasonmode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* IF WITH PLAYER
|
||||||
|
*/
|
||||||
|
$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_played = StatistikoPlayer::query()
|
||||||
|
->whereIn('match_id', $matches_season)
|
||||||
|
->where('ss_player_id', $ss_player_id)
|
||||||
|
->when($player_on_field, function ($query) use ($player_on_field) {
|
||||||
|
// 'all' => 'All',
|
||||||
|
// 'lineup' => 'Lineup',
|
||||||
|
// 'substituted' => 'Substituted',
|
||||||
|
// 'notplayed' => 'Not Played',
|
||||||
|
switch ($player_on_field) {
|
||||||
|
case 'all':
|
||||||
|
return $query->where('minutes_played', '>', 0);
|
||||||
|
case 'lineup':
|
||||||
|
return $query->where('lineup', 'T')->where('minutes_played', '>', 0);
|
||||||
|
case 'substituted':
|
||||||
|
return $query->where('lineup', 'P')->where('minutes_played', '>', 0);
|
||||||
|
default:
|
||||||
|
return $query->where('minutes_played', '>', 0);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
->pluck('match_id')->toArray();
|
||||||
|
|
||||||
|
if (! $matches_played) {
|
||||||
|
$matches_played[] = -1;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// dd($handicap_range, $total_range);
|
||||||
|
/**
|
||||||
|
* STATTISTIC DATA
|
||||||
|
*/
|
||||||
|
// Log::debug('result', [$similar_past_matches, $home_id, $away_id, $team_id]);
|
||||||
|
|
||||||
|
return 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);
|
||||||
|
}
|
||||||
|
})
|
||||||
|
->where(function ($query) use ($team_id, $home_id, $away_id, $similar_past_matches) {
|
||||||
|
if ($similar_past_matches == 'none') {
|
||||||
|
if ($team_id) {
|
||||||
|
return $query->orWhere('home_id', $team_id)
|
||||||
|
->orWhere('away_id', '=', $team_id);
|
||||||
|
} else {
|
||||||
|
return $query->whereIn('home_id', [$home_id, $away_id])->orWhereIn('away_id', [$home_id, $away_id]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
|
->when($matches_played, function ($query) use ($matches_played, $player_on_field) {
|
||||||
|
if ($player_on_field == 'notplayed') {
|
||||||
|
return $query->whereNotIn('match_id', $matches_played);
|
||||||
|
} else {
|
||||||
|
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) {
|
||||||
|
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();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -31,7 +31,7 @@ class CloudflareSolverService
|
|||||||
]);
|
]);
|
||||||
|
|
||||||
if ($response->failed()) {
|
if ($response->failed()) {
|
||||||
Log::error('FlareSolverr Verbindungsfehler. Status: ' . $response->status());
|
// Log::error('FlareSolverr Verbindungsfehler. Status: ' . $response->status());
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
@@ -56,15 +56,15 @@ class CloudflareSolverService
|
|||||||
return $decoded;
|
return $decoded;
|
||||||
}
|
}
|
||||||
|
|
||||||
Log::error('Extrahiertes Textfragment ist kein gültiges JSON.');
|
// Log::error('Extrahiertes Textfragment ist kein gültiges JSON.');
|
||||||
} else {
|
} else {
|
||||||
Log::error('Kein JSON-Muster { ... } im HTML gefunden.');
|
// Log::error('Kein JSON-Muster { ... } im HTML gefunden.');
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
Log::error('FlareSolverr konnte die Seite nicht umgehen: ' . json_encode($data));
|
// Log::error('FlareSolverr konnte die Seite nicht umgehen: '.json_encode($data));
|
||||||
}
|
}
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
Log::error('PHP Exception im CloudflareSolverService: ' . $e->getMessage());
|
// Log::error('PHP Exception im CloudflareSolverService: '.$e->getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
Notice::note('ERROR connecting FLARESOLVERR_IP_DOCKER', 'br', 1);
|
Notice::note('ERROR connecting FLARESOLVERR_IP_DOCKER', 'br', 1);
|
||||||
|
|||||||
Generated
+218
-211
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user