From 23b802abcbb401226145f9c2ed145b8e3e1e168a Mon Sep 17 00:00:00 2001 From: salam Date: Sun, 16 Aug 2026 20:07:17 +0200 Subject: [PATCH] wip --- app/Console/Commands/Grap.php | 2 +- app/Console/Commands/Grapper/Sofascore/Grapper.php | 3 ++- app/Console/Commands/Grapper/Sofascore/Helper/LoadDays.php | 5 ++--- app/Console/Commands/Grapper/Sofascore/Helper/SetStorage.php | 2 +- app/Console/Commands/Grapper/Sofascore/Helper/Strings.php | 1 + app/Filament/Widgets/Data/LoadEvents.php | 2 +- 6 files changed, 8 insertions(+), 7 deletions(-) diff --git a/app/Console/Commands/Grap.php b/app/Console/Commands/Grap.php index 4a9a185d..ad68641a 100644 --- a/app/Console/Commands/Grap.php +++ b/app/Console/Commands/Grap.php @@ -77,7 +77,7 @@ class Grap extends Command case 3: SetStorage::set(3); - // Grapper::load(3); + Grapper::load(3); MakeExcel::create(); diff --git a/app/Console/Commands/Grapper/Sofascore/Grapper.php b/app/Console/Commands/Grapper/Sofascore/Grapper.php index 51d088ba..419422d7 100644 --- a/app/Console/Commands/Grapper/Sofascore/Grapper.php +++ b/app/Console/Commands/Grapper/Sofascore/Grapper.php @@ -50,6 +50,7 @@ class Grapper SofaScoreEventGrapped::where('grapper_id', $task_id)->delete(); foreach ($days as $day) { + // if restarting find position SofaScoreTaskDay::where('grapper_id', (int) $task_id) ->where('day', $day) ->update(['done' => 0]); @@ -211,7 +212,7 @@ class Grapper $count++; if ($debug) { - Notice::note("$count days done", 'bp'); + Notice::note("$count days done", 'p'); } } } diff --git a/app/Console/Commands/Grapper/Sofascore/Helper/LoadDays.php b/app/Console/Commands/Grapper/Sofascore/Helper/LoadDays.php index 4540490a..e25a8041 100644 --- a/app/Console/Commands/Grapper/Sofascore/Helper/LoadDays.php +++ b/app/Console/Commands/Grapper/Sofascore/Helper/LoadDays.php @@ -13,8 +13,7 @@ class LoadDays public static function load(int $task_id) { $debug = Grap::$options['d'] ?? 0; - - $restart = Grap::$options['restart'] ?? 0; + $restart = Grap::$options['r'] ?? 0; $dates = []; @@ -27,7 +26,7 @@ class LoadDays $task = SofaScoreTask::with('sport')->where('id', $task_id)->first(); if ($debug) { - Notice::note('Task id:'.$task->id.', mode:'.$task->mode.', sport:'.$task->sport->name); + Notice::note('Task id:' . $task->id . ', mode:' . $task->mode . ', sport:' . $task->sport->name); } switch ($task->mode) { diff --git a/app/Console/Commands/Grapper/Sofascore/Helper/SetStorage.php b/app/Console/Commands/Grapper/Sofascore/Helper/SetStorage.php index 58145c52..2ba95fdc 100644 --- a/app/Console/Commands/Grapper/Sofascore/Helper/SetStorage.php +++ b/app/Console/Commands/Grapper/Sofascore/Helper/SetStorage.php @@ -34,7 +34,7 @@ class SetStorage Grap::$zipfile = $sofascore_data . $storage_name . '/' . $task->day_from . '.zip'; break; case 3: - Grap::$storage = $sofascore_data . 'range/'; + Grap::$storage = $sofascore_data . 'range/' . $storage_name; Grap::$folder = $storage_name . '-' . $task->day_from . '-' . $task->day_to; break; case 4: diff --git a/app/Console/Commands/Grapper/Sofascore/Helper/Strings.php b/app/Console/Commands/Grapper/Sofascore/Helper/Strings.php index ee67a30d..f0a2172f 100644 --- a/app/Console/Commands/Grapper/Sofascore/Helper/Strings.php +++ b/app/Console/Commands/Grapper/Sofascore/Helper/Strings.php @@ -9,6 +9,7 @@ class Strings { $string = str_replace(' ', '-', $string); // Replaces all spaces with hyphens. $string = preg_replace('/[^A-Za-z0-9\-]/', '', $string); // Removes special chars. + $string = strtolower($string); return preg_replace('/-+/', '-', $string); // Replaces multiple hyphens with single one. } diff --git a/app/Filament/Widgets/Data/LoadEvents.php b/app/Filament/Widgets/Data/LoadEvents.php index 64f06a45..915da789 100644 --- a/app/Filament/Widgets/Data/LoadEvents.php +++ b/app/Filament/Widgets/Data/LoadEvents.php @@ -81,7 +81,7 @@ class LoadEvents $team_position = 'all'; } - $expectations = LoadExpectations::load($res['all'], $match, $statistic_type); + $expectations = LoadExpectations::load($res['all'] ?? [], $match, $statistic_type); foreach ($res[$team_position] as $value) {