[chronojump/michrolab] jump [w/W]eight now called [w/W]eightPercent to avoid mistakes with weight in Kg



commit fef9b2e21d566b13146ee872b342b2fe46b974d8
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Sep 1 13:15:13 2022 +0200

    jump [w/W]eight now called [w/W]eightPercent to avoid mistakes with weight in Kg

 src/gui/jump.cs             |  8 ++++----
 src/jump.cs                 | 30 +++++++++++++++---------------
 src/jumpsWeightFVProfile.cs |  4 ++--
 src/sqlite/jump.cs          |  4 ++--
 src/treeview/jump.cs        | 22 +++++++++++-----------
 5 files changed, 34 insertions(+), 34 deletions(-)
---
diff --git a/src/gui/jump.cs b/src/gui/jump.cs
index 93786ae4f..6c8c5b242 100644
--- a/src/gui/jump.cs
+++ b/src/gui/jump.cs
@@ -170,9 +170,9 @@ public class EditJumpWindow : EditEventWindow
                Jump myJump = (Jump) myEvent;
                if(myJump.TypeHasWeight) {
                        if(weightPercentPreferred)
-                               entryWeight = myJump.Weight.ToString();
+                               entryWeight = myJump.WeightPercent.ToString ();
                        else
-                               entryWeight = Util.WeightFromPercentToKg(myJump.Weight, 
personWeight).ToString();
+                               entryWeight = Util.WeightFromPercentToKg (myJump.WeightPercent, 
personWeight).ToString ();
 
                        entry_weight_value.Text = entryWeight;
                        entry_weight_value.Sensitive = true;
@@ -518,9 +518,9 @@ public class EditJumpRjWindow : EditJumpWindow
                JumpRj myJump = (JumpRj) myEvent;
                if(myJump.TypeHasWeight) {
                        if(weightPercentPreferred)
-                               entryWeight = myJump.Weight.ToString();
+                               entryWeight = myJump.WeightPercent.ToString ();
                        else
-                               entryWeight = Util.WeightFromPercentToKg(myJump.Weight, 
personWeight).ToString();
+                               entryWeight = Util.WeightFromPercentToKg (myJump.WeightPercent, 
personWeight).ToString ();
 
                        entry_weight_value.Text = entryWeight;
                        entry_weight_value.Sensitive = true;
diff --git a/src/jump.cs b/src/jump.cs
index 759508a76..368643765 100644
--- a/src/jump.cs
+++ b/src/jump.cs
@@ -30,7 +30,7 @@ public class Jump : Event
        protected double tc;
        protected double fall;  //-1 if start inside to detect the fall. This is a special case where there 
are two flight times, but 1st is only used to detect fall-
                                //when jump finishes, fall is calculated and 2nd flight time is stored. It 
becomes a jump with one TC and one TF
-       protected double weight; //always write in % (not kg or %) then sqlite can do avgs
+       protected double weightPercent; //always write in % (not kg or %) then sqlite can do avgs
 
        //for not checking always in database
        protected bool hasFall;
@@ -41,7 +41,7 @@ public class Jump : Event
        }
        
        //after inserting database (SQL)
-       public Jump(int uniqueID, int personID, int sessionID, string type, double tv, double tc, double 
fall, double weight, string description, double angle, int simulated, string datetime)
+       public Jump(int uniqueID, int personID, int sessionID, string type, double tv, double tc, double 
fall, double weightPercent, string description, double angle, int simulated, string datetime)
        {
                this.uniqueID = uniqueID;
                this.personID = personID;
@@ -50,7 +50,7 @@ public class Jump : Event
                this.tv = tv;
                this.tc = tc;
                this.fall = fall;
-               this.weight = weight;
+               this.weightPercent = weightPercent;
                this.description = description;
                this.angle = angle;
                this.simulated = simulated;
@@ -67,7 +67,7 @@ public class Jump : Event
                this.tv = Convert.ToDouble(Util.ChangeDecimalSeparator(eventString[4]));
                this.tc = Convert.ToDouble(Util.ChangeDecimalSeparator(eventString[5]));
                this.fall = Convert.ToDouble(Util.ChangeDecimalSeparator(eventString[6]));
-               this.weight = Convert.ToDouble(Util.ChangeDecimalSeparator(eventString[7]));
+               this.weightPercent = Convert.ToDouble(Util.ChangeDecimalSeparator(eventString[7]));
                this.description = eventString[8].ToString();
                this.angle = Convert.ToDouble(Util.ChangeDecimalSeparator(eventString[9]));
                this.simulated = Convert.ToInt32(eventString[10]);
@@ -88,7 +88,7 @@ public class Jump : Event
                                uniqueID.ToString(), 
                                personID, sessionID, 
                                type, tv, tc, fall, 
-                               weight, description, 
+                               weightPercent, description, 
                                angle, simulated, datetime);
        }
 
@@ -185,13 +185,13 @@ public class Jump : Event
                set { fall = value; }
        }
        
-       public double Weight {
-               get { return weight; }
-               set { weight = value; }
+       public double WeightPercent {
+               get { return weightPercent; }
+               set { weightPercent = value; }
        }
        public double WeightInKg (double personMassInKg)
        {
-               return Util.WeightFromPercentToKg (weight, personMassInKg);
+               return Util.WeightFromPercentToKg (weightPercent, personMassInKg);
        }
 
        public double RSI {
@@ -239,7 +239,7 @@ public class JumpRj : Jump
 
        public JumpRj(int uniqueID, int personID, int sessionID, string type,
                        double tvMax, double tcMax,
-                       double fall, double weight, string description,
+                       double fall, double weightPercent, string description,
                        double tvAvg, double tcAvg,
                        string tvString, string tcString,
                        int jumps, double time, string limited,
@@ -252,7 +252,7 @@ public class JumpRj : Jump
                this.tvMax = tvMax;
                this.tcMax = tcMax;
                this.fall = fall;
-               this.weight = weight;
+               this.weightPercent = weightPercent;
                this.description = description;
                this.tvAvg = tvAvg;
                this.tcAvg = tcAvg;
@@ -270,7 +270,7 @@ public class JumpRj : Jump
        
        //after inserting database (SQL)
        public JumpRj(int uniqueID, int personID, int sessionID, string type, 
-                       string tvString, string tcString, double fall, double weight, 
+                       string tvString, string tcString, double fall, double weightPercent, 
                        string description, int jumps, double time, string limited, string angleString, int 
simulated, string datetime)
        {
                this.uniqueID = uniqueID;
@@ -280,7 +280,7 @@ public class JumpRj : Jump
                this.tvString = tvString;
                this.tcString = tcString;
                this.fall = fall;
-               this.weight = weight;
+               this.weightPercent = weightPercent;
                this.description = description;
                this.jumps = jumps;
                this.time = time;
@@ -305,7 +305,7 @@ public class JumpRj : Jump
                this.tvString = Util.ChangeDecimalSeparator(eventString[11].ToString());
                this.tcString = Util.ChangeDecimalSeparator(eventString[12].ToString());
                this.fall = Convert.ToDouble(Util.ChangeDecimalSeparator(eventString[6]));
-               this.weight = Convert.ToDouble(Util.ChangeDecimalSeparator(eventString[7]));
+               this.weightPercent = Convert.ToDouble(Util.ChangeDecimalSeparator(eventString[7]));
                this.description = eventString[8].ToString();
                this.jumps = Convert.ToInt32(eventString[13]);
                this.time = Convert.ToDouble(Util.ChangeDecimalSeparator(eventString[14]));
@@ -330,7 +330,7 @@ public class JumpRj : Jump
                return SqliteJumpRj.Insert(dbconOpened, tableName, 
                                uniqueID.ToString(),
                                personID, sessionID, 
-                               type, TvMax, TcMax, fall, weight,
+                               type, TvMax, TcMax, fall, weightPercent,
                                description, TvAvg, TcAvg, tvString, tcString,
                                jumps, time, limited, 
                                angleString, simulated, datetime);
diff --git a/src/jumpsWeightFVProfile.cs b/src/jumpsWeightFVProfile.cs
index c0857510f..78bfdd599 100644
--- a/src/jumpsWeightFVProfile.cs
+++ b/src/jumpsWeightFVProfile.cs
@@ -58,7 +58,7 @@ public class JumpsWeightFVProfile
                        //Samozino formula is F = m*g*( (h/hp0) +1)
                        //h is jump's height
                        //hp0 = trochanterToe - trochanterFloorOnFlexion
-                       double force = (personWeight + (personWeight * j.Weight / 100.0)) * 9.81 * ( ( 
jumpHeightM / hp0 ) + 1 );
+                       double force = (personWeight + (personWeight * j.WeightPercent / 100.0)) * 9.81 * ( ( 
jumpHeightM / hp0 ) + 1 );
                        //use force relative
                        //force /= personWeight;
                        //not because affects z and other calculations, do it later, just on the cairo graph
@@ -69,7 +69,7 @@ public class JumpsWeightFVProfile
                        // 3 add informational height and extra weight
                        List<KeyDouble> lkd = new List<KeyDouble>();
                        lkd.Add(new KeyDouble("Height (cm)", jumpHeightM * 100.0));
-                       lkd.Add(new KeyDouble("Extra weight (Kg)", personWeight * j.Weight / 100.0));
+                       lkd.Add(new KeyDouble("Extra weight (Kg)", personWeight * j.WeightPercent / 100.0));
                        p.l_keydouble = lkd;
 
                        //4 add to point_l
diff --git a/src/sqlite/jump.cs b/src/sqlite/jump.cs
index 3d09c2c22..aa8564d5b 100644
--- a/src/sqlite/jump.cs
+++ b/src/sqlite/jump.cs
@@ -535,10 +535,10 @@ class SqliteJump : Sqlite
                  double lastWeight = 0;
                  foreach(Jump j in jmp_l)
                  {
-                         if(j.Weight != lastWeight)
+                         if(j.WeightPercent != lastWeight)
                                  jmp_l_purged.Add(j);
 
-                         lastWeight = j.Weight;
+                         lastWeight = j.WeightPercent;
                  }
                  return jmp_l_purged;
          }
diff --git a/src/treeview/jump.cs b/src/treeview/jump.cs
index 14c46dbdc..99bc06fdc 100644
--- a/src/treeview/jump.cs
+++ b/src/treeview/jump.cs
@@ -170,11 +170,11 @@ public class TreeViewJumps : TreeViewEvent
                myJump.Simulated = Convert.ToInt32(myStringOfData[11].ToString());
                myJump.Datetime = myStringOfData[12].ToString();
 
-               myJump.Weight = Convert.ToDouble(myStringOfData[8].ToString());
+               myJump.WeightPercent = Convert.ToDouble(myStringOfData[8].ToString());
 
                //to calculate potency
                personWeight = Convert.ToDouble(myStringOfData[13]);
-               weightInKg = Util.WeightFromPercentToKg(myJump.Weight, personWeight);
+               weightInKg = Util.WeightFromPercentToKg (myJump.WeightPercent, personWeight);
 
                return myJump;
        }
@@ -200,13 +200,13 @@ public class TreeViewJumps : TreeViewEvent
                //Also this is needed on Add (where personWeight is passed using PersonWeight, but not 
weightInKg)
                //LogB.Information("getLineToStore personWeight: " + personWeight.ToString());
                weightInKg = Util.WeightFromPercentToKg(
-                               Convert.ToDouble(newJump.Weight.ToString()),
+                               Convert.ToDouble (newJump.WeightPercent.ToString ()),
                                personWeight);
                
                if(preferences.weightStatsPercent)
-                       myData[count++] = Util.TrimDecimals(newJump.Weight.ToString(), pDN);
+                       myData[count++] = Util.TrimDecimals (newJump.WeightPercent.ToString(), pDN);
                else
-                       myData[count++] = Util.TrimDecimals(weightInKg.ToString(), pDN);
+                       myData[count++] = Util.TrimDecimals (weightInKg.ToString (), pDN);
 
                myData[count++] = Util.TrimDecimals(newJump.Fall.ToString(), pDN);
                myData[count++] = Util.TrimDecimals(Util.GetHeightInCentimeters(newJump.Tv.ToString()), pDN);
@@ -303,10 +303,10 @@ public class TreeViewJumpsRj : TreeViewJumps
                myJumpRj.Simulated = Convert.ToInt32(myStringOfData[18].ToString());
                myJumpRj.Datetime = myStringOfData[19].ToString();
                
-               myJumpRj.Weight = Convert.ToDouble(myStringOfData[8].ToString());
+               myJumpRj.WeightPercent = Convert.ToDouble (myStringOfData[8].ToString());
 
                personWeight = Convert.ToDouble(myStringOfData[20]);
-               weightInKg = Util.WeightFromPercentToKg(myJumpRj.Weight, personWeight);
+               weightInKg = Util.WeightFromPercentToKg (myJumpRj.WeightPercent, personWeight);
 
                return myJumpRj;
        }
@@ -332,7 +332,7 @@ public class TreeViewJumpsRj : TreeViewJumps
                myData[count++] = "";
                
                weightInKg = Util.WeightFromPercentToKg(
-                               Convert.ToDouble(newJumpRj.Weight.ToString()),
+                               Convert.ToDouble (newJumpRj.WeightPercent.ToString()),
                                personWeight);
                myData[count++] = Util.TrimDecimals(weightInKg.ToString(), pDN);
 
@@ -390,7 +390,7 @@ public class TreeViewJumpsRj : TreeViewJumps
                
                //This is needed on Add (where personWeight is passed using PersonWeight, but not weightInKg)
                weightInKg = Util.WeightFromPercentToKg(
-                               Convert.ToDouble(newJumpRj.Weight.ToString()),
+                               Convert.ToDouble (newJumpRj.WeightPercent.ToString()),
                                personWeight);
                
                if (preferences.showPower) {
@@ -517,8 +517,8 @@ public class TreeViewJumpsRj : TreeViewJumps
                         * in order to calculate the total, AVG, SD using that data
                         */
 
-                       weightInKg = Util.WeightFromPercentToKg(
-                                       Convert.ToDouble(newJumpRj.Weight.ToString()),
+                       weightInKg = Util.WeightFromPercentToKg (
+                                       Convert.ToDouble (newJumpRj.WeightPercent.ToString ()),
                                        personWeight);
 
                        string [] tc_array = newJumpRj.TcString.Split(new char[] {'='});


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