[chronojump/chronojump-importer] Imports person_session_77 and updates the session_ids accordingly for other tables.
- From: Carles Pina i Estany <carlespina src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump/chronojump-importer] Imports person_session_77 and updates the session_ids accordingly for other tables.
- Date: Mon, 5 Sep 2016 15:42:03 +0000 (UTC)
commit 4b87f4adf822df576f66fde60cc1445a9417b2ed
Author: Carles Pina i Estany <carles pina cat>
Date: Mon Sep 5 16:41:34 2016 +0100
Imports person_session_77 and updates the session_ids accordingly for other tables.
src/chronojump-importer/chronojump_importer.py | 24 ++++++++++++++++++++++++
1 files changed, 24 insertions(+), 0 deletions(-)
---
diff --git a/src/chronojump-importer/chronojump_importer.py b/src/chronojump-importer/chronojump_importer.py
index 77aa862..bcc0b2e 100755
--- a/src/chronojump-importer/chronojump_importer.py
+++ b/src/chronojump-importer/chronojump_importer.py
@@ -423,6 +423,21 @@ def update_persons77_ids(table, persons77_list):
return result
+
+def update_session_ids(table, new_session_id):
+ result = copy.deepcopy(table)
+
+ changed = False
+
+ for row in table:
+ row["sessionID"] = new_session_id
+ changed = True
+ break
+
+ assert changed
+
+ return result
+
def import_database(source_path, destination_path, source_session):
""" Imports the session source_session from source_db into destination_db """
@@ -480,6 +495,7 @@ def import_database(source_path, destination_path, source_session):
where_condition="JumpRj.sessionID={}".format(source_session))
jump_rj = update_persons77_ids(jump_rj, persons77)
+ jump_rj = update_session_ids(jump_rj, new_session_id)
insert_data(database=destination_db, table_name="JumpRj", data=jump_rj, matches_columns=None)
@@ -488,9 +504,17 @@ def import_database(source_path, destination_path, source_session):
where_condition="Jump.sessionID={}".format(source_session))
jump = update_persons77_ids(jump, persons77)
+ jump = update_session_ids(jump, new_session_id)
insert_data(database=destination_db, table_name="Jump", data=jump, matches_columns=None)
+ # Imports PersonSession77
+ person_session_77 = return_data_from_table(database=source_db, table_name="PersonSession77",
+
where_condition="PersonSession77.sessionID={}".format(source_session))
+ person_session_77 = update_persons77_ids(person_session_77, persons77)
+ person_session_77 = update_session_ids(person_session_77, new_session_id)
+ insert_data(database=destination_db, table_name="PersonSession77", data=person_session_77,
matches_columns=None)
+
### Continue from here
# import_person_session_77(source_db, destination_db, source_session, new_session_id)
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]