Various cleanup in import.

This commit is contained in:
James Cole
2018-01-10 18:18:49 +01:00
parent 87dae6ea18
commit 91178d2604
10 changed files with 272 additions and 153 deletions

View File

@@ -51,9 +51,10 @@ class ImportJobRepository implements ImportJobRepositoryInterface
*/
public function addError(ImportJob $job, int $index, string $error): ImportJob
{
$job->addError($index, $error);
$extended = $this->getExtendedStatus($job);
$extended['errors'][$index][] = $error;
return $job;
return $this->setExtendedStatus($job, $extended);
}
/**
@@ -64,9 +65,11 @@ class ImportJobRepository implements ImportJobRepositoryInterface
*/
public function addStepsDone(ImportJob $job, int $steps = 1): ImportJob
{
$job->addStepsDone($steps);
$status = $this->getExtendedStatus($job);
$status['done'] += $steps;
Log::debug(sprintf('Add %d to steps done for job "%s" making steps done %d', $steps, $job->key, $status['done']));
return $job;
return $this->setExtendedStatus($status);
}
/**
@@ -175,6 +178,16 @@ class ImportJobRepository implements ImportJobRepositoryInterface
return [];
}
/**
* @param ImportJob $job
*
* @return string
*/
public function getStatus(ImportJob $job): string
{
return $job->status;
}
/**
* @param ImportJob $job
* @param UploadedFile $file