mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-28 01:41:14 -06:00
Fix broken duplication test routine.
This commit is contained in:
parent
1e3d85439e
commit
b09504d0f7
@ -384,13 +384,14 @@ class TransactionJournalFactory
|
||||
*/
|
||||
private function hashArray(NullArrayObject $row): string
|
||||
{
|
||||
$row['import_hash_v2'] = null;
|
||||
$row['original_source'] = null;
|
||||
$json = json_encode($row);
|
||||
$dataRow = $row->getArrayCopy();
|
||||
|
||||
unset($dataRow['import_hash_v2'], $dataRow['original_source']);
|
||||
$json = json_encode($dataRow);
|
||||
if (false === $json) {
|
||||
// @codeCoverageIgnoreStart
|
||||
$json = json_encode((string)microtime());
|
||||
Log::error(sprintf('Could not hash the original row! %s', json_last_error_msg()), $row->getArrayCopy());
|
||||
Log::error(sprintf('Could not hash the original row! %s', json_last_error_msg()), $dataRow);
|
||||
// @codeCoverageIgnoreEnd
|
||||
}
|
||||
$hash = hash('sha256', $json);
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user