[chronojump] Fixed error in weight display in curves analyze table



commit 1a552ef52907d2cdd85dfbd1364a68cfe6c2b2ca
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri May 16 17:49:49 2014 +0200

    Fixed error in weight display in curves analyze table

 src/constants.cs            |    1 +
 src/gui/encoder.cs          |   11 +++++++++--
 src/gui/encoderTreeviews.cs |   19 ++++++++++++-------
 3 files changed, 22 insertions(+), 9 deletions(-)
---
diff --git a/src/constants.cs b/src/constants.cs
index dc566e8..0d4f182 100644
--- a/src/constants.cs
+++ b/src/constants.cs
@@ -740,6 +740,7 @@ public class Constants
                FIRST, AVERAGE, LAST
        }
        
+       //DISPLACED means: total
        public enum MassType {
                BODY, EXTRA, DISPLACED
        }       
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 229c495..2d6dc72 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -3026,8 +3026,15 @@ Log.WriteLine(str);
                                encoderExercisesTranslationAndBodyPWeight);
                if(Util.IsNumber(found, false))
                        return Convert.ToInt32(found);
-               else
-                       return -1;
+               else {
+                       //try untranslated
+                       found = Util.FindOnArray(':', 1, 3, name, 
+                                       encoderExercisesTranslationAndBodyPWeight);
+                       if(Util.IsNumber(found, false))
+                               return Convert.ToInt32(found);
+                       else
+                               return -1;
+               }
        }
        int getExercisePercentBodyWeightFromCombo () {
                return getExercisePercentBodyWeightFromName (UtilGtk.ComboGetActive(combo_encoder_exercise));
diff --git a/src/gui/encoderTreeviews.cs b/src/gui/encoderTreeviews.cs
index d44f93d..a3269b0 100644
--- a/src/gui/encoderTreeviews.cs
+++ b/src/gui/encoderTreeviews.cs
@@ -261,7 +261,7 @@ public partial class ChronoJumpWindow
                Catalog.GetString("Series") + "\n",
                Catalog.GetString("Exercise") + "\n",
                Catalog.GetString("Extra weight") + "\n (Kg)",
-               Catalog.GetString("Displaced weight") + "\n (Kg)",
+               Catalog.GetString("Total weight") + "\n (Kg)",
                Catalog.GetString("Start") + "\n (s)",
                Catalog.GetString("Duration") + "\n (s)",
                Catalog.GetString("Distance") + "\n (cm)",
@@ -284,10 +284,10 @@ public partial class ChronoJumpWindow
                //write exercise and extra weight data
                ArrayList curvesData = new ArrayList();
                string exerciseName = "";
-               double displacedMass = 0; 
+               double totalMass = 0; 
                if(check_encoder_analyze_signal_or_curves.Active) {     //current signal
                        exerciseName = UtilGtk.ComboGetActive(combo_encoder_exercise);
-                       displacedMass = findMass(Constants.MassType.DISPLACED);
+                       totalMass = findMass(Constants.MassType.DISPLACED);
                } else {                                                //user curves
                        curvesData = SqliteEncoder.Select(
                                        false, -1, currentPerson.UniqueID, currentSession.UniqueID, "curve", 
true);
@@ -312,20 +312,25 @@ public partial class ChronoJumpWindow
                                
                                if(! check_encoder_analyze_signal_or_curves.Active) {   //user curves
                                        /*
+                                        * better don't do this to avoid calling SQL in both treads
                                        EncoderSQL eSQL = (EncoderSQL) curvesData[curvesCount];
                                        exerciseName = eSQL.exerciseName;
-                                       displacedMass = eSQL.extraWeight;
+                                       totalMass = eSQL.extraWeight;
                                        */
                                        exerciseName = cells[2];
-                                       displacedMass = Convert.ToDouble(cells[4]);
+                                       //cells[3]: massBody
+                                       //cells[4]: massExtra
+
+                                       totalMass = Convert.ToDouble(cells[3]) * 
getExercisePercentBodyWeightFromName (exerciseName) / 100.0
+                                               + Convert.ToDouble(cells[4]);
                                }
 
                                encoderAnalyzeCurves.Add (new EncoderCurve (
                                                        cells[0], 
                                                        cells[1],       //seriesName 
                                                        exerciseName,
-                                                       massWithoutPerson(displacedMass, exerciseName),
-                                                       displacedMass,
+                                                       Convert.ToDouble(cells[4]),
+                                                       totalMass,
                                                        cells[5], cells[6], cells[7], 
                                                        cells[8], cells[9], cells[10], 
                                                        cells[11], cells[12], cells[13],


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