[chronojump] DB: 2.29 ForceSensor ALTER TABLE added maxForceRaw, maxAvgForce1s



commit 48663da08ea4e7d91af096af0cd2cef5b89cfb39
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Jan 4 13:20:10 2022 +0100

    DB: 2.29 ForceSensor ALTER TABLE added maxForceRaw, maxAvgForce1s

 src/sqlite/forceSensor.cs | 17 +++++++++++++----
 src/sqlite/main.cs        | 12 ++++++++++--
 2 files changed, 23 insertions(+), 6 deletions(-)
---
diff --git a/src/sqlite/forceSensor.cs b/src/sqlite/forceSensor.cs
index 35f6562e5..83fb0259f 100644
--- a/src/sqlite/forceSensor.cs
+++ b/src/sqlite/forceSensor.cs
@@ -15,7 +15,7 @@
  *  along with this program; if not, write to the Free Software
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * Copyright (C) 2017-2020   Xavier de Blas <xaviblas gmail com> 
+ * Copyright (C) 2017-2022   Xavier de Blas <xaviblas gmail com>
  */
 
 using System;
@@ -57,7 +57,9 @@ class SqliteForceSensor : Sqlite
                        "comments TEXT, " +
                        "videoURL TEXT, " +     //URL of video of signals. stored as relative
                        "stiffness FLOAT DEFAULT -1, " +        //this is the important, next one is needed 
for recalculate, but note that some bands can have changed or being deleted
-                       "stiffnessString TEXT)"; //uniqueID*active of ElasticBand separated by ';' or empty 
if exerciseID ! elastic
+                       "stiffnessString TEXT, " + //uniqueID*active of ElasticBand separated by ';' or empty 
if exerciseID ! elastic
+                       "maxForceRaw FLOAT, " +
+                       "maxAvgForce1s FLOAT)";
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
        }
@@ -68,7 +70,9 @@ class SqliteForceSensor : Sqlite
 
                LogB.Information("goint to insert: " + insertString);
                dbcmd.CommandText = "INSERT INTO " + table +
-                               " (uniqueID, personID, sessionID, exerciseID, captureOption, angle, 
laterality, filename, url, dateTime, comments, videoURL, stiffness, stiffnessString)" +
+                               " (uniqueID, personID, sessionID, exerciseID, captureOption, angle, 
laterality," +
+                               " filename, url, dateTime, comments, videoURL, stiffness, stiffnessString," +
+                               " maxForceRaw, maxAvgForce1s)" +
                                " VALUES " + insertString;
                LogB.SQL(dbcmd.CommandText.ToString());
                dbcmd.ExecuteNonQuery();
@@ -181,7 +185,11 @@ class SqliteForceSensor : Sqlite
                                        Convert.ToDouble(Util.ChangeDecimalSeparator(
                                                        reader[12].ToString())), //stiffness
                                        reader[13].ToString(),                  //stiffnessString
-                                       reader[14].ToString()                   //exerciseName
+                                       Convert.ToDouble(Util.ChangeDecimalSeparator(
+                                                       reader[14].ToString())), //maxForceRaw
+                                       Convert.ToDouble(Util.ChangeDecimalSeparator(
+                                                       reader[15].ToString())), //maxAVgForce1s
+                                       reader[16].ToString()                   //exerciseName
                                        );
                        list.Add(fs);
                }
@@ -414,6 +422,7 @@ class SqliteForceSensor : Sqlite
                                                
Util.MakeURLrelative(Util.GetForceSensorSessionDir(Convert.ToInt32(session.Name))),
                                                parsedDate, fslt.Comment,
                                                "", -1, "", //videoURL, stiffness, stiffnessString
+                                               -1, -1, //maxForceRaw, maxAvgForce1s
                                                exerciseName);
                                forceSensor.InsertSQL(true);
                                conversionSubRate ++;
diff --git a/src/sqlite/main.cs b/src/sqlite/main.cs
index 888945aaf..303674bf9 100644
--- a/src/sqlite/main.cs
+++ b/src/sqlite/main.cs
@@ -15,7 +15,7 @@
  *  along with this program; if not, write to the Free Software
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * Copyright (C) 2004-2021   Xavier de Blas <xaviblas gmail com>
+ * Copyright (C) 2004-2022   Xavier de Blas <xaviblas gmail com>
  */
 
 using System;
@@ -129,7 +129,7 @@ class Sqlite
        /*
         * Important, change this if there's any update to database
         */
-       static string lastChronojumpDatabaseVersion = "2.28";
+       static string lastChronojumpDatabaseVersion = "2.29";
 
        public Sqlite()
        {
@@ -3065,6 +3065,13 @@ class Sqlite
                                SqlitePreferences.Insert (SqlitePreferences.ShowJumpRSI, "True");
                                currentVersion = updateVersion("2.28");
                        }
+                       if(currentVersion == "2.28")
+                       {
+                               LogB.SQL("ForceSensor ALTER TABLE added maxForceRaw, maxAvgForce1s");
+                               executeSQL("ALTER TABLE " + Constants.ForceSensorTable + " ADD COLUMN 
maxForceRAW FLOAT DEFAULT -1;");
+                               executeSQL("ALTER TABLE " + Constants.ForceSensorTable + " ADD COLUMN 
maxAvgForce1s FLOAT DEFAULT -1;");
+                               currentVersion = updateVersion("2.29");
+                       }
 
                        /*
                        if(currentVersion == "1.79")
@@ -3284,6 +3291,7 @@ class Sqlite
                //changes [from - to - desc]
 //just testing: 1.79 - 1.80 Converted DB to 1.80 Created table ForceSensorElasticBandGlue and moved 
stiffnessString records there
 
+               //2.28 - 2.29 Converted DB to 2.29 ForceSensor ALTER TABLE added maxForceRaw, maxAvgForce1s
                //2.27 - 2.28 Converted DB to 2.28 Inserted at preferences showJumpRSI
                //2.26 - 2.27 Converted DB to 2.27 Inserted lastBackupDir, lastBackupDatetime, 
backupScheduledCreatedDate, backupScheduledNextDays
                //2.25 - 2.26 Converted DB to 2.26 contactsCaptureDisplay with BooleansInt, and bool 
runEncoderCaptureDisplaySimple


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