evaluationRunId); if (! $run || $run->isCanceled()) { return; } $coordinator = new EvaluationCoordinator(); try { $coordinator->eventInfo($run, 'Parsování logů: krok spuštěn.', [ 'step' => 'parse_logs', 'round_id' => $run->round_id, ]); $logIds = Log::where('round_id', $run->round_id)->pluck('id'); $total = $logIds->count(); $run->update([ 'status' => 'RUNNING', 'current_step' => 'parse_logs', 'progress_total' => $total, 'progress_done' => 0, 'started_at' => $run->started_at ?? Carbon::now(), ]); $jobs = []; foreach ($logIds as $logId) { $jobs[] = new ParseLogJob($run->id, (int) $logId); } $next = function () use ($run) { if ($run->rules_version === 'CLAIMED') { RecalculateClaimedRanksJob::dispatch($run->id) ->delay(now()->addSeconds(10)) ->onQueue('evaluation'); } Bus::chain([ new DispatchBuildWorkingSetJobsJob($run->id), ])->onQueue('evaluation')->dispatch(); }; if (! $jobs) { $next(); return; } $batch = Bus::batch($jobs) ->then($next) ->onQueue('evaluation') ->dispatch(); $run->update(['batch_id' => $batch->id]); } catch (Throwable $e) { $message = "DispatchParseLogsJobsJob selhal (run {$run->id}): {$e->getMessage()}"; \Log::error($message); $coordinator->eventError($run, $message, [ 'step' => 'parse_logs', 'round_id' => $run->round_id, ]); throw $e; } } }