From 423dc9831032d358bd95f76c5fe12c75e9ef6920 Mon Sep 17 00:00:00 2001
From: Jacek Kowalski <Jacek@jacekk.info>
Date: Wed, 20 Feb 2019 08:57:11 +0000
Subject: [PATCH] Override the previous mapping with updated data, not the other way around

---
 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