mirror of
https://github.com/firefly-iii/firefly-iii.git
synced 2024-12-30 10:47:06 -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
|
private function hashArray(NullArrayObject $row): string
|
||||||
{
|
{
|
||||||
$row['import_hash_v2'] = null;
|
$dataRow = $row->getArrayCopy();
|
||||||
$row['original_source'] = null;
|
|
||||||
$json = json_encode($row);
|
unset($dataRow['import_hash_v2'], $dataRow['original_source']);
|
||||||
|
$json = json_encode($dataRow);
|
||||||
if (false === $json) {
|
if (false === $json) {
|
||||||
// @codeCoverageIgnoreStart
|
// @codeCoverageIgnoreStart
|
||||||
$json = json_encode((string)microtime());
|
$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
|
// @codeCoverageIgnoreEnd
|
||||||
}
|
}
|
||||||
$hash = hash('sha256', $json);
|
$hash = hash('sha256', $json);
|
||||||
|
@ -234,6 +234,16 @@ class ImportArrayStorage
|
|||||||
private function storeGroup(int $index, array $group): ?TransactionGroup
|
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!
|
// do duplicate detection!
|
||||||
if ($this->duplicateDetected($index, $group)) {
|
if ($this->duplicateDetected($index, $group)) {
|
||||||
Log::warning(sprintf('Row #%d seems to be a imported already and will be ignored.', $index));
|
Log::warning(sprintf('Row #%d seems to be a imported already and will be ignored.', $index));
|
||||||
@ -241,14 +251,6 @@ class ImportArrayStorage
|
|||||||
return null;
|
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
|
// store the group
|
||||||
try {
|
try {
|
||||||
$newGroup = $this->groupRepos->store($group);
|
$newGroup = $this->groupRepos->store($group);
|
||||||
|
Loading…
Reference in New Issue
Block a user