[chronojump/chronojump-importer] Better output for inserted and reused rows.
- From: Carles Pina i Estany <carlespina src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump/chronojump-importer] Better output for inserted and reused rows.
- Date: Wed, 7 Sep 2016 11:43:49 +0000 (UTC)
commit f78789229a03e66162d05532f96da58fa7daea2d
Author: Carles Pina i Estany <carles pina cat>
Date: Wed Sep 7 11:07:30 2016 +0100
Better output for inserted and reused rows.
src/chronojump-importer/chronojump_importer.py | 14 ++++++++------
.../chronojump_importer_test.py | 2 +-
2 files changed, 9 insertions(+), 7 deletions(-)
---
diff --git a/src/chronojump-importer/chronojump_importer.py b/src/chronojump-importer/chronojump_importer.py
index 273fdd8..aeaf624 100755
--- a/src/chronojump-importer/chronojump_importer.py
+++ b/src/chronojump-importer/chronojump_importer.py
@@ -219,18 +219,20 @@ def update_session_ids(table, new_session_id):
def print_summary(table_name, table_data):
- inserted = 0
- reused = 0
+ inserted_ids = []
+ reused_ids = []
for row in table_data:
if row['importer_action'] == 'inserted':
- inserted += 1
+ inserted_ids.append(row['uniqueID'])
+
elif row['importer_action'] == 'reused':
- reused += 1
+ reused_ids.append(row['uniqueID'])
else:
assert False
- print("{table_name} - inserted: {inserted}, reused: {reused}".format(table_name=table_name,
inserted=inserted, reused=reused))
-
+ print("{table_name}".format(table_name=table_name))
+ print("\tinserted: {inserted_counter} uniqueIDs: {inserted}".format(inserted_counter=len(inserted_ids),
inserted=inserted_ids))
+ print("\treused: {reused_counter} uniqueIDs: {reused}".format(reused_counter=len(reused_ids),
reused=reused_ids))
def remove_duplicates_list(l):
""" Returns a new list without duplicate elements. """
diff --git a/src/chronojump-importer/chronojump_importer_test.py
b/src/chronojump-importer/chronojump_importer_test.py
index 065dd20..101a777 100755
--- a/src/chronojump-importer/chronojump_importer_test.py
+++ b/src/chronojump-importer/chronojump_importer_test.py
@@ -19,7 +19,7 @@ class TestImporter(unittest.TestCase):
shutil.rmtree(self.temporary_directory_path)
# lists the names. They will expand to generic-destination-X.sqlite / generic-source-X.sqlite /
generic-expected-X.sqlite
- @ddt.data("a", "b")
+ @ddt.data("a", "b", "c")
def test_importerGeneric(self, data):
generic_test = data
source_file_name = "generic-source-{}.sqlite".format(generic_test)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]