[chronojump] At import old sensor files: unknown person/ps if person cannot match
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] At import old sensor files: unknown person/ps if person cannot match
- Date: Wed, 16 Oct 2019 10:27:09 +0000 (UTC)
commit 63bff3bb603d539d31a9b172890b245312f987cf
Author: Xavier de Blas <xaviblas gmail com>
Date: Wed Oct 16 12:26:02 2019 +0200
At import old sensor files: unknown person/ps if person cannot match
src/chronojump-importer/chronojump_importer.py | 6 ++++++
src/chronojumpImporter.cs | 3 +++
src/sqlite/forceSensor.cs | 27 +++++++++++++++++++++-----
3 files changed, 31 insertions(+), 5 deletions(-)
---
diff --git a/src/chronojump-importer/chronojump_importer.py b/src/chronojump-importer/chronojump_importer.py
index 002a9d15..10b29f7c 100755
--- a/src/chronojump-importer/chronojump_importer.py
+++ b/src/chronojump-importer/chronojump_importer.py
@@ -37,6 +37,12 @@ debugFile = ""
*/
"""
+"""
+/*
+ * note there is a diagram on diagrams/processes/import
+ */
+"""
+
class Row:
""" A row represents a row in a table: it has column-names and their values.
diff --git a/src/chronojumpImporter.cs b/src/chronojumpImporter.cs
index 1db2d04d..28dd0a9c 100644
--- a/src/chronojumpImporter.cs
+++ b/src/chronojumpImporter.cs
@@ -27,6 +27,9 @@ using Mono.Unix;
* Copyright (C) 2019 Xavier de Blas <xaviblas gmail com>
*/
+/*
+ * note there is a diagram on diagrams/processes/import
+ */
class ChronojumpImporter
{
diff --git a/src/sqlite/forceSensor.cs b/src/sqlite/forceSensor.cs
index 6591f699..55598b39 100644
--- a/src/sqlite/forceSensor.cs
+++ b/src/sqlite/forceSensor.cs
@@ -271,11 +271,22 @@ class SqliteForceSensor : Sqlite
forceSensorDir = Path.Combine(Util.GetDatabaseTempImportDir(), "forceSensor");
int unknownPersonID = Sqlite.ExistsAndGetUniqueID(true, Constants.PersonTable,
Catalog.GetString("Unknown"));
+ bool personSessionExistsInSession;
int unknownExerciseID = Sqlite.ExistsAndGetUniqueID(true, Constants.ForceSensorExerciseTable,
Catalog.GetString("Unknown"));
DirectoryInfo [] sessions = new DirectoryInfo(forceSensorDir).GetDirectories();
foreach (DirectoryInfo session in sessions) //session.Name will be the UniqueID
{
+ //if there is a session where the user manually changed the folder name (has to be a
sessionID)
+ //to any other thing, then do not import this session
+ if(! Util.IsNumber(session.Name, false))
+ continue;
+
+ if(unknownPersonID == -1)
+ personSessionExistsInSession = false;
+ else
+ personSessionExistsInSession =
SqlitePersonSession.PersonSelectExistsInSession(true, unknownPersonID, Convert.ToInt32(session.Name));
+
FileInfo[] files = session.GetFiles();
foreach (FileInfo file in files)
{
@@ -284,13 +295,11 @@ class SqliteForceSensor : Sqlite
new ForceSensorLoadTryToAssignPersonAndMore(true,
fileWithoutExtension, Convert.ToInt32(session.Name));
Person p = fslt.GetPerson();
- //if person is not foundz
+ //if person is not found
if(p.UniqueID == -1)
{
if(unknownPersonID == -1)
{
-//TODO: atencio pq aixo no s'esta insertant al final, s'inserta pero no sabem de moment on
-//i suposo que l'exercici tampoc
LogB.Information("going to insert person Unknown");
Person pUnknown = new Person (Catalog.GetString("Unknown"),
"M", DateTime.Now,
Constants.RaceUndefinedID,
@@ -298,11 +307,19 @@ class SqliteForceSensor : Sqlite
"", "", //future1: rfid
Constants.ServerUndefinedID, true);
//dbconOpened
unknownPersonID = pUnknown.UniqueID;
-
- //el crea pero no queda guardat a la bd
}
p.UniqueID = unknownPersonID;
p.Name = Catalog.GetString("Unknown");
+
+ if(! personSessionExistsInSession)
+ {
+ LogB.Information("going to insert personSession");
+ PersonSession ps = new PersonSession(unknownPersonID,
Convert.ToInt32(session.Name), 0, 75,
+ Constants.SportUndefinedID,
Constants.SpeciallityUndefinedID, Constants.LevelUndefinedID,
+ "", true); //comments,
dbconOpened
+
+ personSessionExistsInSession = true;
+ }
}
if(! Util.IsNumber(session.Name, false))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]