lots of progress

This commit is contained in:
2025-01-26 21:36:05 +02:00
parent bbd082fd8f
commit 6a014c403c
44 changed files with 976 additions and 104 deletions
@@ -45,18 +45,9 @@ class FetchItemDataCommand extends Command
private function getBatch(string $type, int $batch, string $job)
{
return ItemToFetch::has('jobs')
->with([
// 'jobs' => fn ($jobs) => dd($jobs->first()->remaining_jobs) /*array_search($job, $jobs->first()->remaining_jobs, true)*/,
'jobs' => function ($jobs) use ($job) {
$remainingJobs = $jobs->first()->remaining_jobs;
if (is_string($remainingJobs)) {
$remainingJobs = json_decode($jobs->first()->remaining_jobs, true);
}
return array_search($job, $remainingJobs, true);
},
])
return ItemToFetch::whereHas('jobs', function($query) use ($job){
return $query->where('jobs', '<>', null)->whereRaw('FIND_IN_SET(?, jobs)', [$job]);
})->with(['jobs'])
->where('type', $type)
->take($batch)
->get();