[chronojump/chronojump-importer: 51/66] Fixes bug when importing personalized JumpTypes.



commit bb2bf8f291e6e92c370e05c9bc8d2a0e6d7cb6cd
Author: Carles Pina i Estany <carles pina cat>
Date:   Sun Sep 18 17:56:48 2016 +0100

    Fixes bug when importing personalized JumpTypes.
    
    Pending a proper unit test for the Database::write method (and
    _avoid_duplicate_value).

 src/chronojump-importer/chronojump_importer.py     |    3 ++-
 .../tests/user-jump-expected.sqlite                |  Bin 52224 -> 52224 bytes
 2 files changed, 2 insertions(+), 1 deletions(-)
---
diff --git a/src/chronojump-importer/chronojump_importer.py b/src/chronojump-importer/chronojump_importer.py
index b6d342c..8412454 100755
--- a/src/chronojump-importer/chronojump_importer.py
+++ b/src/chronojump-importer/chronojump_importer.py
@@ -344,7 +344,7 @@ class Database:
         if column_name is None:
             return
 
-        data_row.set('old_' + column_name, data_row.get(column_name))
+        original_value = data_row.get(column_name)
 
         while True:
             sql = "SELECT count(*) FROM {table_name} WHERE {column}=?".format(table_name=table_name, 
column=column_name)
@@ -358,6 +358,7 @@ class Database:
             else:
                 data_row.set(column_name, self.increment_suffix(data_row.get(column_name)))
                 data_row.set('new_' + column_name, data_row.get(column_name))
+                data_row.set('old_' + column_name, original_value)
 
     def _execute_query_and_log(self, sql, where_values):
         logging.debug("SQL: {} - values: {}".format(sql, where_values))
diff --git a/src/chronojump-importer/tests/user-jump-expected.sqlite 
b/src/chronojump-importer/tests/user-jump-expected.sqlite
index aee6630..47622a0 100644
Binary files a/src/chronojump-importer/tests/user-jump-expected.sqlite and 
b/src/chronojump-importer/tests/user-jump-expected.sqlite differ


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]