From 64994ed50bf27f21ec4a17c241f72bc333ed1afe Mon Sep 17 00:00:00 2001
From: Jacek Kowalski <Jacek@jacekk.info>
Date: Wed, 20 Feb 2019 09:00:24 +0000
Subject: [PATCH] Use transaction to add mapping to the DB
---
parse.php | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/parse.php b/parse.php
index c6406b3..f438ba6 100644
--- a/parse.php
+++ b/parse.php
@@ -79,7 +79,7 @@
$previousMapping = NULL;
if($incorrect > $correct && $maxWeight > $weight) {
throw new Exception('Ignoring result due to better data already present');
- } elseif($old > 0 && $incorrect == 0) {
+ } elseif($old > $correct) {
$logger->warn('Replacing DB data with the new mapping');
$db->clear();
} else {
@@ -90,7 +90,7 @@
if(is_array($previousMapping)) {
$logger->info('Merging previous data with current mapping');
- $mapping = $previousMapping + $mapping;
+ $mapping = $mapping + $previousMapping;
ksort($mapping);
}
--
Gitblit v1.9.1