wip
This commit is contained in:
1 parent
78db21c71c
commit
e1f3b728a9
9 files changed
+97
-48
No files matched your search
@@ -129,7 +129,7 @@ class Statistic extends BaseDashboard
|
||||
|
||||
Grid::make([
|
||||
'default' => 1,
|
||||
'sm' => 3,
|
||||
'sm' => 2,
|
||||
'md' => 5,
|
||||
])
|
||||
->columnSpanFull()
|
||||
@@ -184,9 +184,9 @@ class Statistic extends BaseDashboard
|
||||
Action::make('esc')
|
||||
->hiddenLabel()
|
||||
->visible(fn(Get $get) => $get('similar_past_matches') != 'none')
|
||||
->tooltip('Clear all (esc)')
|
||||
->tooltip('Clear All (esc)')
|
||||
->icon('phosphor-x-circle')
|
||||
->color('warning')
|
||||
->color('danger')
|
||||
->keyBindings(['esc'])
|
||||
->action('resetFilters'),
|
||||
|
||||
@@ -202,7 +202,12 @@ class Statistic extends BaseDashboard
|
||||
return 'danger';
|
||||
}
|
||||
})
|
||||
->prefixIcon('phosphor-users-three-fill')
|
||||
->prefixIcon('phosphor-users-fill')
|
||||
->suffixAction(Action::make('reset')
|
||||
->icon('phosphor-x-circle')
|
||||
->tooltip('Clear Team')
|
||||
->action(fn(callable $set) => $set('team_id', null))
|
||||
->color(fn(Get $get): string => $get('team_id') != 0 ? 'danger' : 'gray'))
|
||||
->hidden(fn(Get $get) => $get('similar_past_matches') != 'none')
|
||||
->options(function (Get $get) {
|
||||
if ($get('match_id')) {
|
||||
@@ -222,7 +227,14 @@ class Statistic extends BaseDashboard
|
||||
$this->dispatch('reset-tab');
|
||||
})
|
||||
->placeholder('Select Team'),
|
||||
|
||||
]),
|
||||
Grid::make([
|
||||
'default' => 1,
|
||||
'sm' => 3,
|
||||
'md' => 5,
|
||||
])
|
||||
->columnSpanFull()
|
||||
->schema([
|
||||
Select::make('team_position')
|
||||
->live()
|
||||
->hiddenLabel()
|
||||
@@ -244,14 +256,6 @@ class Statistic extends BaseDashboard
|
||||
])->afterStateUpdated(function (callable $set) {
|
||||
$set('ss_player_id', null);
|
||||
}),
|
||||
]),
|
||||
Grid::make([
|
||||
'default' => 1,
|
||||
'sm' => 3,
|
||||
'md' => 5,
|
||||
])
|
||||
->columnSpanFull()
|
||||
->schema([
|
||||
Select::make('statistic_type')
|
||||
->live()
|
||||
->hiddenLabel()
|
||||
@@ -289,19 +293,20 @@ class Statistic extends BaseDashboard
|
||||
->live()
|
||||
// ->columnSpan(2)
|
||||
->hiddenLabel()
|
||||
->hidden(fn(Get $get) => $get('team_id') != null)
|
||||
->columnSpan(fn(Get $get) => $get('similar_past_matches') != 'none' ? 2 : 1)
|
||||
->suffixAction(Action::make('reset')
|
||||
->icon('phosphor-x-circle')
|
||||
->tooltip('Clear SMP')
|
||||
->action(fn(callable $set) => $set('similar_past_matches', 'none'))
|
||||
->color(fn (Get $get): string => $get('similar_past_matches') != 'none' ? 'info' : 'gray'))
|
||||
->color(fn(Get $get): string => $get('similar_past_matches') != 'none' ? 'danger' : 'gray'))
|
||||
->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>') : '')
|
||||
->prefix('SPM')
|
||||
->prefixAction(
|
||||
Action::make('iconInfo')
|
||||
->icon('phosphor-question-fill')
|
||||
// ->color(fn(Get $get): string => $get('similar_past_matches') != 'none' ? 'success' : 'primary')
|
||||
->color('success')
|
||||
->color(fn(Get $get): string => $get('similar_past_matches') != 'none' ? 'success' : 'danger')
|
||||
->tooltip(fn() => $this->tooltip_similar_past_matches())
|
||||
)
|
||||
->default('none')
|
||||
|
||||
@@ -11,7 +11,6 @@ class LoadEventsBoxes
|
||||
$league_id = (int) $filter['league_id'] ?? 0;
|
||||
$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'];
|
||||
|
||||
if (! $league_id) {
|
||||
@@ -20,9 +19,6 @@ class LoadEventsBoxes
|
||||
if (! $match_id) {
|
||||
return [];
|
||||
}
|
||||
if (! $team_id) {
|
||||
return [];
|
||||
}
|
||||
|
||||
$match = StatisticFixtures::with('home')->with('away')->where('id', (int) $match_id)->first();
|
||||
|
||||
|
||||
@@ -33,8 +33,6 @@ class BoxesBettypeAll extends StatsOverviewWidget
|
||||
{
|
||||
$data = LoadEventsBoxes::load($this->filters, false);
|
||||
|
||||
// dd($data);
|
||||
|
||||
$similar_past_matches = $this->filters['similar_past_matches'];
|
||||
$team_position = $this->filters['team_position'];
|
||||
|
||||
|
||||
@@ -38,6 +38,10 @@ class CloudflareSolverService
|
||||
|
||||
$data = $response->json();
|
||||
|
||||
$tmp = json_encode($data);
|
||||
// if (strpos($tmp, "reason") !== false && strpos($tmp, 403) !== false)
|
||||
// dd($data);
|
||||
|
||||
if (isset($data['status']) && $data['status'] === 'ok') {
|
||||
$htmlContent = $data['solution']['response'];
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ namespace App\Traits\Sofascore;
|
||||
|
||||
use App\Utilities\Notice;
|
||||
use Illuminate\Support\Carbon;
|
||||
use Illuminate\Support\Facades\File;
|
||||
|
||||
use function Laravel\Prompts\select;
|
||||
use function Laravel\Prompts\text;
|
||||
@@ -62,9 +63,7 @@ trait GrapSofascore
|
||||
switch ($grapperSelected) {
|
||||
case 'daily':
|
||||
$this->task_id = 1;
|
||||
|
||||
$this->days_back = (int) $this->select_day();
|
||||
|
||||
$this->run_daily($grapperSelected);
|
||||
break;
|
||||
|
||||
@@ -76,16 +75,19 @@ trait GrapSofascore
|
||||
case 'settings':
|
||||
$this->settings_to_local();
|
||||
break;
|
||||
|
||||
case 'excel':
|
||||
$folder = $this->select_folder();
|
||||
|
||||
$this->import_to_excel($folder);
|
||||
break;
|
||||
|
||||
case 'mail':
|
||||
$folder = $this->select_folder();
|
||||
|
||||
$this->send($folder);
|
||||
break;
|
||||
|
||||
case 'clear':
|
||||
$folder = $this->select_folder();
|
||||
|
||||
@@ -117,7 +119,16 @@ trait GrapSofascore
|
||||
|
||||
$this->load_tournaments_requested($folder);
|
||||
|
||||
$restart = $this->ask_restart();
|
||||
switch ($restart) {
|
||||
case 'restart':
|
||||
$this->restart = 1;
|
||||
break;
|
||||
case 'clear':
|
||||
$this->restart = 1;
|
||||
$this->clear_folder($folder, 'all');
|
||||
break;
|
||||
}
|
||||
|
||||
/**
|
||||
* day 1
|
||||
@@ -196,12 +207,18 @@ trait GrapSofascore
|
||||
$this->set_base_dir($folder);
|
||||
|
||||
$restart = $this->ask_restart();
|
||||
|
||||
if ($restart == 'yes') {
|
||||
switch ($restart) {
|
||||
case 'restart':
|
||||
$this->restart = 1;
|
||||
break;
|
||||
case 'clear':
|
||||
$this->restart = 1;
|
||||
$this->clear_folder($folder, 'all');
|
||||
break;
|
||||
}
|
||||
|
||||
$day_done = $this->days_done();
|
||||
|
||||
$this->load_tournaments_requested($folder);
|
||||
|
||||
$this->load_days($folder);
|
||||
@@ -213,18 +230,34 @@ trait GrapSofascore
|
||||
Notice::note("$key/$count", 'br');
|
||||
}
|
||||
|
||||
if (in_array($day, $day_done)) {
|
||||
if ($this->debug) {
|
||||
Notice::note("$day already in folder", 'br');
|
||||
}
|
||||
} else {
|
||||
$this->grap_tournaments_for_day($day);
|
||||
|
||||
foreach ($this->tournaments_requested as $tournament) {
|
||||
$this->get_event($day, $tournament);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$this->import_to_excel($folder);
|
||||
|
||||
Notice::note('Done', 'g');
|
||||
}
|
||||
|
||||
protected function days_done(): array
|
||||
{
|
||||
$directories = File::directories($this->data_dir);
|
||||
$arr = [];
|
||||
foreach ($directories as $directory) {
|
||||
$arr[] = substr(strrchr($directory, "/"), 1);
|
||||
}
|
||||
return $arr;
|
||||
}
|
||||
|
||||
/**
|
||||
* Summary of select_grapper
|
||||
*/
|
||||
@@ -279,8 +312,9 @@ trait GrapSofascore
|
||||
label: 'Restart Grapper?',
|
||||
default: 'no',
|
||||
options: [
|
||||
'yes' => 'Yes',
|
||||
'no' => 'No',
|
||||
'restart' => 'Restart',
|
||||
'clear' => 'Clear folder and restart',
|
||||
]
|
||||
);
|
||||
}
|
||||
|
||||
@@ -19,7 +19,7 @@ trait GrapperEvent
|
||||
if ($res) {
|
||||
|
||||
if ($this->debug) {
|
||||
Notice::note("$day - ".$tournament['tournament']['name'].' - '.$tournament['sofa_score_tournament_id'], 'b');
|
||||
Notice::note("$day - " . $tournament['tournament']['name'] . ' - ' . $tournament['sofa_score_tournament_id'], 'bb');
|
||||
}
|
||||
|
||||
$this->sleep(1);
|
||||
@@ -27,7 +27,7 @@ trait GrapperEvent
|
||||
$url = $this->base_url . 'api/v1/unique-tournament/' . $tournament['sofa_score_tournament_id'] . "/scheduled-events/$day";
|
||||
|
||||
if ($this->debug) {
|
||||
Notice::note($url, 'bb');
|
||||
Notice::note($url, 'b');
|
||||
}
|
||||
|
||||
$this->sleep(1);
|
||||
@@ -40,7 +40,7 @@ trait GrapperEvent
|
||||
|
||||
foreach ($data['events'] as $event) {
|
||||
|
||||
if (! $this->force && SofaScoreEventGrapped::where('grapper_id', $this->task_id)->where('id', (int) $event['id'])->exists()) {
|
||||
if (! $this->restart && SofaScoreEventGrapped::where('grapper_id', $this->task_id)->where('id', (int) $event['id'])->exists()) {
|
||||
if ($this->debug) {
|
||||
Notice::note('DB - Allready grapped at ' . $day . ' - ' . $event['homeTeam']['name'] . ' vs ' . $event['awayTeam']['name'], 'b');
|
||||
}
|
||||
|
||||
@@ -73,19 +73,19 @@ trait GrappingHelper
|
||||
break;
|
||||
}
|
||||
|
||||
if ($this->restart) {
|
||||
SofaScoreEventGrapped::where('grapper_id', $this->task_id)->delete();
|
||||
// if ($this->restart) {
|
||||
// SofaScoreEventGrapped::where('grapper_id', $this->task_id)->delete();
|
||||
|
||||
foreach ($this->days as $day) {
|
||||
// if restarting find position
|
||||
SofaScoreTaskDay::where('grapper_id', 1)
|
||||
->where('day', $day)
|
||||
->update(['done' => 0]);
|
||||
}
|
||||
if ($this->debug) {
|
||||
Notice::note('Grapper restarted', 'r', 1);
|
||||
}
|
||||
}
|
||||
// foreach ($this->days as $day) {
|
||||
// // if restarting find position
|
||||
// SofaScoreTaskDay::where('grapper_id', 1)
|
||||
// ->where('day', $day)
|
||||
// ->update(['done' => 0]);
|
||||
// }
|
||||
// if ($this->debug) {
|
||||
// Notice::note('Grapper restarted', 'r', 1);
|
||||
// }
|
||||
// }
|
||||
|
||||
$this->days = array_unique($this->days, SORT_REGULAR);
|
||||
}
|
||||
|
||||
@@ -19,17 +19,29 @@ trait GrappingToExcel
|
||||
ini_set('memory_limit', -1);
|
||||
|
||||
if ($this->debug) {
|
||||
Notice::note("Import to Excel", 'bb');
|
||||
Notice::note("Import $folder to Excel", 'bb');
|
||||
}
|
||||
|
||||
$directories = File::directories($this->data_dir . '/' . $folder);
|
||||
|
||||
switch ($folder) {
|
||||
case 'daily':
|
||||
$directories = File::directories($this->data_dir);
|
||||
foreach ($directories as $directory) {
|
||||
|
||||
$day = substr(strrchr($directory, "/"), 1);
|
||||
|
||||
$this->titel = ucfirst($folder) . '-' . $day;
|
||||
$this->make_file($this->data_dir . '/' . $day);
|
||||
}
|
||||
break;
|
||||
|
||||
case 'range':
|
||||
$task = SofaScoreTask::with('sport')->where('id', 3)->first();
|
||||
$this->titel = ucfirst($folder) . '-' . $this->clean_string($task->name);
|
||||
$this->make_file($this->data_dir);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
protected function make_file(string $directory)
|
||||
{
|
||||
$files = $this->get_tree($directory);
|
||||
|
||||
// only json max 2000
|
||||
@@ -80,7 +92,6 @@ trait GrappingToExcel
|
||||
$writer->save("$this->data_dir/$this->titel-$count_from-$count_to.xlsx");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
protected function filter(array $files, array $types = ['json'])
|
||||
{
|
||||
|
||||
@@ -7,5 +7,6 @@ services:
|
||||
environment:
|
||||
- LOG_LEVEL=info
|
||||
- TZ=Europe/Vienna
|
||||
- LANG=en-US
|
||||
- HOST=0.0.0.0
|
||||
restart: always
|
||||
Reference in new issue
Block a user