[chronojump] encoder Squat 75% -> 100%. DB:0.91



commit 3bad4191fc278d8c69cad5a2e8915efca5fa3322
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed Apr 24 15:39:27 2013 +0200

    encoder Squat 75% -> 100%. DB:0.91

 src/sqlite/encoder.cs |   21 ++++++++++++++++++++-
 src/sqlite/main.cs    |   14 +++++++++++++-
 2 files changed, 33 insertions(+), 2 deletions(-)
---
diff --git a/src/sqlite/encoder.cs b/src/sqlite/encoder.cs
index adb0514..0e032f5 100644
--- a/src/sqlite/encoder.cs
+++ b/src/sqlite/encoder.cs
@@ -317,7 +317,7 @@ class SqliteEncoder : Sqlite
                string [] iniEncoderExercises = {
                        //name:percentBodyWeight:ressistance:description
                        "Bench press:0:weight bar:", 
-                       "Squat:75:weight bar:", 
+                       "Squat:100:weight bar:", 
                        "Jump:100:none:",
                        "Free:0::"      
                };
@@ -328,6 +328,25 @@ class SqliteEncoder : Sqlite
                }
        }
 
+       public static void UpdateExercise(bool dbconOpened, string name, int percentBodyWeight, 
+                       string ressistance, string description)
+       {
+               if(! dbconOpened)
+                       dbcon.Open();
+
+               dbcmd.CommandText = "UPDATE " + Constants.EncoderExerciseTable + " SET " +
+                               " percentBodyWeight = " + percentBodyWeight +
+                               ", ressistance = '" + ressistance +
+                               "', description = '" + description +
+                               "' WHERE name = '" + name + "'" ;
+
+               Log.WriteLine(dbcmd.CommandText.ToString());
+               dbcmd.ExecuteNonQuery();
+
+               if(! dbconOpened)
+                       dbcon.Close();
+       }
+       
        //if uniqueID != -1, returns an especific EncoderExercise that can be read like this    
        //EncoderExercise ex = (EncoderExercise) SqliteEncoder.SelectEncoderExercises(eSQL.exerciseID)[0];
        public static ArrayList SelectEncoderExercises(bool dbconOpened, int uniqueID, bool onlyNames) 
diff --git a/src/sqlite/main.cs b/src/sqlite/main.cs
index 3a07372..a860b4c 100644
--- a/src/sqlite/main.cs
+++ b/src/sqlite/main.cs
@@ -72,7 +72,7 @@ class Sqlite
         * Important, change this if there's any update to database
         * Important2: if database version get numbers higher than 1, check if the comparisons with 
currentVersion works ok
         */
-       static string lastChronojumpDatabaseVersion = "0.90";
+       static string lastChronojumpDatabaseVersion = "0.91";
 
        public Sqlite() {
        }
@@ -1229,6 +1229,17 @@ class Sqlite
 
                                currentVersion = "0.90";
                        }
+                       if(currentVersion == "0.90") {
+                               dbcon.Open();
+                               
+                               SqliteEncoder.UpdateExercise(true, "Squat", 100, "weight bar", "");     
+                               Log.WriteLine("Encoder Squat 75% -> 100%");
+                               
+                               SqlitePreferences.Update ("databaseVersion", "0.91", true); 
+                               dbcon.Close();
+
+                               currentVersion = "0.91";
+                       }
                }
 
                //if changes are made here, remember to change also in CreateTables()
@@ -1367,6 +1378,7 @@ class Sqlite
                SqliteCountry.initialize();
                
                //changes [from - to - desc]
+               //0.90 - 0.91 Converted DB to 0.91 Encoder Squat 75% -> 100%
                //0.89 - 0.90 Converted DB to 0.90 Preferences added propulsive and encoder smooth
                //0.88 - 0.89 Converted DB to 0.89 Added encoder exercise: Free
                //0.87 - 0.88 Converted DB to 0.88 Deleted fake RSA test and added known RSA tests


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