mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2025-11-17 23:28:20 +00:00
Make sure number of steps is always correct.
This commit is contained in:
@@ -72,6 +72,23 @@ class ImportJobRepository implements ImportJobRepositoryInterface
|
||||
return $this->setExtendedStatus($job, $status);
|
||||
}
|
||||
|
||||
/**
|
||||
* @param ImportJob $job
|
||||
* @param int $steps
|
||||
*
|
||||
* @return ImportJob
|
||||
*/
|
||||
public function addTotalSteps(ImportJob $job, int $steps = 1): ImportJob
|
||||
{
|
||||
$extended = $this->getExtendedStatus($job);
|
||||
$total = $extended['steps'] ?? 0;
|
||||
$total += $steps;
|
||||
$extended['steps'] = $total;
|
||||
|
||||
return $this->setExtendedStatus($job, $extended);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Return number of imported rows with this hash value.
|
||||
*
|
||||
@@ -320,15 +337,17 @@ class ImportJobRepository implements ImportJobRepositoryInterface
|
||||
|
||||
/**
|
||||
* @param ImportJob $job
|
||||
* @param int $count
|
||||
* @param int $steps
|
||||
*
|
||||
* @return ImportJob
|
||||
*/
|
||||
public function setStepsDone(ImportJob $job, int $steps): ImportJob
|
||||
{
|
||||
$job->setStepsDone($steps);
|
||||
$status = $this->getExtendedStatus($job);
|
||||
$status['done'] = $steps;
|
||||
Log::debug(sprintf('Set steps done for job "%s" to %d', $job->key, $steps));
|
||||
|
||||
return $job;
|
||||
return $this->setExtendedStatus($job, $status);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -339,9 +358,11 @@ class ImportJobRepository implements ImportJobRepositoryInterface
|
||||
*/
|
||||
public function setTotalSteps(ImportJob $job, int $count): ImportJob
|
||||
{
|
||||
$job->setTotalSteps($count);
|
||||
$status = $this->getExtendedStatus($job);
|
||||
$status['steps'] = $count;
|
||||
Log::debug(sprintf('Set total steps for job "%s" to %d', $job->key, $count));
|
||||
|
||||
return $job;
|
||||
return $this->setExtendedStatus($job, $status);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user