[chronojump] Fixes on jumps profile graph



commit f424255d6aae24df449f2b8ef0ff7e540982326c
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed Jun 29 19:13:09 2016 +0200

    Fixes on jumps profile graph

 src/gui/jumpsProfile.cs        |   10 ++++----
 src/sqlite/stat.cs             |   42 +++++++++++++++++++++++++++++++++++----
 src/stats/chronojumpProfile.cs |    2 +-
 3 files changed, 43 insertions(+), 11 deletions(-)
---
diff --git a/src/gui/jumpsProfile.cs b/src/gui/jumpsProfile.cs
index e901141..7cefe8f 100644
--- a/src/gui/jumpsProfile.cs
+++ b/src/gui/jumpsProfile.cs
@@ -112,11 +112,11 @@ public class JumpsProfileGraph
                int textHeight = 12;
                g.SetFontSize(textHeight);
                
-               printText(460,  50, height, textHeight, Util.TrimDecimals((100 * index1 / sum),1) + "% F. 
Maximum (SJ100%)", g);
-               printText(460, 119, height, textHeight, Util.TrimDecimals((100 * index2 / sum),1) + "% F. 
Explosive (SJ - SJ100%)", g);
-               printText(460, 188, height, textHeight, Util.TrimDecimals((100 * index3 / sum),1) + "% Hab. 
Elastic (CMJ - SJ)", g);
-               printText(460, 257, height, textHeight, Util.TrimDecimals((100 * index4 / sum),1) + "% Hab. 
Arms (ABK - CMJ)", g);
-               printText(460, 326, height, textHeight, Util.TrimDecimals((100 * index5 / sum),1) + "% F. 
Reactive-reflex (DJa)", g);
+               printText(460,  50, height, textHeight, Util.TrimDecimals((100 * index1 / sum),1) + "% F. 
Maximum  SJ100% / DJa", g);
+               printText(460, 119, height, textHeight, Util.TrimDecimals((100 * index2 / sum),1) + "% F. 
Explosive  (SJ - SJ100%) / Dja", g);
+               printText(460, 188, height, textHeight, Util.TrimDecimals((100 * index3 / sum),1) + "% Hab. 
Elastic  (CMJ - SJ) / Dja", g);
+               printText(460, 257, height, textHeight, Util.TrimDecimals((100 * index4 / sum),1) + "% Hab. 
Arms  (ABK - CMJ) / Dja", g);
+               printText(460, 326, height, textHeight, Util.TrimDecimals((100 * index5 / sum),1) + "% F. 
Reactive-reflex  (DJa - ABK) / Dja", g);
 
                g.GetTarget().Dispose ();
                g.Dispose ();
diff --git a/src/sqlite/stat.cs b/src/sqlite/stat.cs
index 99cf11f..f46bee5 100644
--- a/src/sqlite/stat.cs
+++ b/src/sqlite/stat.cs
@@ -1415,9 +1415,24 @@ LogB.SQL(intervalSpeeds);
 
                Sqlite.Open();
                
+               //this is used in all indexes
+               double DjaMax = selectDouble( 
+                               "SELECT MAX(tv * tv * 1.226) " +
+                               " FROM jump " +
+                               " WHERE type = \"DJa\" " +
+                               " AND personID = " + personID + " AND sessionID = " + sessionID);
+
+               List<Double> l = new List<Double>();
+               //if not Dja, return a 00000 list
+               if(DjaMax == 0) {
+                       for(int i=0; i <= 4; i++)
+                               l.Add(0);
+                       return l;
+               }
+               
                //select personID and each index (using IDDoubleLists)
                double fMax = selectDouble( 
-                               "SELECT MAX(jump.tv * jump.tv * 1.226) " +
+                               "SELECT MAX(tv * tv * 1.226) " +
                                " FROM jump " +
                                " WHERE type = \"SJl\" AND jump.weight = 100 " +
                                " AND personID = " + personID + " AND sessionID = " + sessionID);
@@ -1444,13 +1459,25 @@ LogB.SQL(intervalSpeeds);
                                " AND j1.sessionID = " + sessionID + " AND j2.sessionID = " + sessionID);
 
                double fReact = selectDouble( 
-                               "SELECT MAX(jump.tv * jump.tv * 1.226) " +
-                               " FROM jump WHERE type = \"DJa\" " +
-                               " AND personID = " + personID + " AND sessionID = " + sessionID);
+                               "SELECT MAX(j1.tv * j1.tv * 1.226) - MAX(j2.tv * j2.tv * 1.226) AS myIndex " +
+                               " FROM jump AS j1, jump AS j2 " +
+                               " WHERE j1.type = \"DJa\" AND j2.type = \"ABK\" " +
+                               " AND j1.personID = " + personID + " AND j2.personID = " + personID + 
+                               " AND j1.sessionID = " + sessionID + " AND j2.sessionID = " + sessionID);
+               
+               if(fMax > 0)
+                       fMax /= DjaMax;
+               if(fExpl > 0)
+                       fExpl /= DjaMax;
+               if(cElast > 0)
+                       cElast /= DjaMax;
+               if(cArms > 0)
+                       cArms /= DjaMax;
+               if(fReact > 0)
+                       fReact /= DjaMax;
        
                Sqlite.Close();
 
-               List<Double> l = new List<Double>();            
                l.Add(fMax);
                l.Add(fExpl);
                l.Add(cElast);
@@ -1460,6 +1487,10 @@ LogB.SQL(intervalSpeeds);
        }
 
        //all persons in session (unused)
+       /*
+        * Note criteria of indexeshas changed see method above
+        */
+       /*
        public static ArrayList SelectChronojumpProfile (string sessionID)
        {
                Sqlite.Open();
@@ -1525,5 +1556,6 @@ LogB.SQL(intervalSpeeds);
                Sqlite.Close();
                return arrayReturn;
        }
+       */
 
 }
diff --git a/src/stats/chronojumpProfile.cs b/src/stats/chronojumpProfile.cs
index 1f594cb..aad519b 100644
--- a/src/stats/chronojumpProfile.cs
+++ b/src/stats/chronojumpProfile.cs
@@ -109,7 +109,7 @@ public class StatChronojumpProfile : Stat
 
                                string [] sessionFull = sessions[0].ToString().Split(new char[] {':'});
                                //SqliteStat.SelectChronojumpProfile(sessionFull[0]);
-                               processDataSimpleSession (SqliteStat.SelectChronojumpProfile(sessionFull[0]), 
true, dataColumns);
+                               //processDataSimpleSession 
(SqliteStat.SelectChronojumpProfile(sessionFull[0]), true, dataColumns);
                        //}
                //}
        }


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