some progress on processing
This commit is contained in:
@@ -3,6 +3,8 @@
|
||||
namespace App\Console\Commands\ItemProcessing;
|
||||
|
||||
use App\Models\ItemToFetch;
|
||||
use App\Models\ItemToFetchJobs;
|
||||
use App\Models\Movie;
|
||||
use App\Service\MediaProcessing\FactoryService;
|
||||
use Illuminate\Console\Command;
|
||||
|
||||
@@ -45,9 +47,16 @@ class FetchItemDataCommand extends Command
|
||||
|
||||
private function getBatch(string $type, int $batch, string $job)
|
||||
{
|
||||
return ItemToFetch::whereHas('jobs', function($query) use ($job){
|
||||
// if job <> Details the movie in movie table should exist
|
||||
$query = ItemToFetch::whereHas('jobs', function($query) use ($job){
|
||||
return $query->where('jobs', '<>', null)->whereRaw('FIND_IN_SET(?, jobs)', [$job]);
|
||||
})->with(['jobs'])
|
||||
})->with(['jobs']);
|
||||
|
||||
if ($job !== ItemToFetchJobs::JOB_DETAILS) {
|
||||
$query = $query->join('movies', 'movies.tmdb_id', '=', 'items_to_fetch.tmdb_id');
|
||||
}
|
||||
|
||||
return $query
|
||||
->where('type', $type)
|
||||
->take($batch)
|
||||
->get();
|
||||
|
||||
Reference in New Issue
Block a user