Fix some last minute issues.

This commit is contained in:
James Cole 2018-04-01 08:50:23 +02:00
parent 52656b25da
commit 093bdd6090
No known key found for this signature in database
GPG Key ID: C16961E655E74B5E
2 changed files with 6 additions and 7 deletions

View File

@ -313,8 +313,6 @@ class ImportStorage
} }
$this->addStep(); $this->addStep();
$this->journals->push($factoryJournal);
Log::info( Log::info(
sprintf( sprintf(
'Imported new journal #%d: "%s", amount %s %s.', $factoryJournal->id, $factoryJournal->description, $factoryJournal->transactionCurrency->code, 'Imported new journal #%d: "%s", amount %s %s.', $factoryJournal->id, $factoryJournal->description, $factoryJournal->transactionCurrency->code,

View File

@ -375,7 +375,7 @@ class TagRepository implements TagRepositoryInterface
/** @var array $entry */ /** @var array $entry */
foreach ($temporary as $entry) { foreach ($temporary as $entry) {
$scale = $this->cloudScale([12, 20], floatval($entry['amount']), floatval($min), floatval($max)); $scale = $this->cloudScale([12, 20], (float)$entry['amount'], (float)$min, (float)$max);
$tagId = $entry['tag']['id']; $tagId = $entry['tag']['id'];
$return[$tagId] = [ $return[$tagId] = [
'scale' => $scale, 'scale' => $scale,
@ -424,14 +424,15 @@ class TagRepository implements TagRepositoryInterface
$diff = $range[1] - $range[0]; $diff = $range[1] - $range[0];
$step = 1; $step = 1;
if (0 != $diff) { if (0.0 !== $diff) {
$step = $amountDiff / $diff; $step = $amountDiff / $diff;
} }
if (0 == $step) { if (0.0 === $step) {
$step = 1; $step = 1;
} }
$extra = round($amount / $step);
return intval($range[0] + $extra); $extra = $step / $amount;
$result = (int)($range[0] + $extra);
return $result;
} }
} }