Fix broken duplication test routine.

This commit is contained in:
James Cole
2019-08-09 18:35:34 +02:00
parent 1e3d85439e
commit b09504d0f7
2 changed files with 15 additions and 12 deletions

View File

@@ -234,6 +234,16 @@ class ImportArrayStorage
private function storeGroup(int $index, array $group): ?TransactionGroup
{
Log::debug(sprintf('Going to store entry #%d', $index + 1));
// do some basic error catching.
foreach ($group['transactions'] as $groupIndex => $transaction) {
$group['transactions'][$groupIndex]['date'] = Carbon::parse($transaction['date'], config('app.timezone'));
$group['transactions'][$groupIndex]['description'] = '' === $transaction['description'] ? '(empty description)' : $transaction['description'];
}
// do duplicate detection!
if ($this->duplicateDetected($index, $group)) {
Log::warning(sprintf('Row #%d seems to be a imported already and will be ignored.', $index));
@@ -241,14 +251,6 @@ class ImportArrayStorage
return null;
}
Log::debug(sprintf('Going to store entry #%d', $index + 1));
// do some basic error catching.
foreach ($group['transactions'] as $index => $transaction) {
$group['transactions'][$index]['date'] = Carbon::parse($transaction['date'], config('app.timezone'));
$group['transactions'][$index]['description'] = '' === $transaction['description'] ? '(empty description)' : $transaction['description'];
}
// store the group
try {
$newGroup = $this->groupRepos->store($group);