[chronojump] Best intersession jump with context info



commit 413423be72ff543b81bca15d555b0988b342f0ab
Author: Xavier de Blas <xaviblas gmail com>
Date:   Sat Jun 25 19:08:54 2016 +0200

    Best intersession jump with context info

 glade/chronojump.glade  |   81 +++++++++++++++++++++++++++++++++++++++++++++--
 src/gui/eventExecute.cs |   16 +++++++++
 src/sqlite/jump.cs      |   41 ++++++++++++++++++++++++
 3 files changed, 135 insertions(+), 3 deletions(-)
---
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index 42c1da3..560db80 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -6968,6 +6968,27 @@ after time</property>
                                                             <property name="position">1</property>
                                                             </packing>
                                                             </child>
+                                                            <child>
+                                                            <widget class="GtkButton" 
id="button_person_max_all_sessions_info">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">True</property>
+                                                            <property name="receives_default">True</property>
+                                                            <signal name="clicked" 
handler="on_button_person_max_all_sessions_info_clicked" swapped="no"/>
+                                                            <child>
+                                                            <widget class="GtkImage" id="image65">
+                                                            <property name="visible">True</property>
+                                                            <property name="can_focus">False</property>
+                                                            <property name="stock">gtk-info</property>
+                                                            <property name="icon-size">2</property>
+                                                            </widget>
+                                                            </child>
+                                                            </widget>
+                                                            <packing>
+                                                            <property name="expand">True</property>
+                                                            <property name="fill">True</property>
+                                                            <property name="position">2</property>
+                                                            </packing>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">True</property>
@@ -16691,6 +16712,9 @@ on current Chronojump version.</property>
                                                             <child>
                                                             <placeholder/>
                                                             </child>
+                                                            <child>
+                                                            <placeholder/>
+                                                            </child>
                                                             </widget>
                                                             <packing>
                                                             <property name="expand">False</property>
@@ -21401,6 +21425,9 @@ by you</property>
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                     </child>
                   </widget>
@@ -22592,6 +22619,9 @@ by you</property>
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                     </child>
                   </widget>
@@ -24275,6 +24305,9 @@ by you</property>
               <placeholder/>
             </child>
             <child>
+              <placeholder/>
+            </child>
+            <child>
               <widget class="GtkButton" id="button_video_url">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
@@ -25015,6 +25048,9 @@ by you</property>
             <child>
               <placeholder/>
             </child>
+            <child>
+              <placeholder/>
+            </child>
           </widget>
           <packing>
             <property name="expand">True</property>
@@ -38113,6 +38149,24 @@ options</property>
                             <child>
                               <placeholder/>
                             </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
+                            <child>
+                              <placeholder/>
+                            </child>
                           </widget>
                         </child>
                       </widget>
@@ -40840,6 +40894,18 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
                     <child>
                       <placeholder/>
                     </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </widget>
                 </child>
               </widget>
@@ -42074,9 +42140,6 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
                                       <placeholder/>
                                     </child>
                                     <child>
-                                      <placeholder/>
-                                    </child>
-                                    <child>
                                       <widget class="GtkLabel" id="label218">
                                         <property name="visible">True</property>
                                         <property name="can_focus">False</property>
@@ -43267,6 +43330,9 @@ To differentiate between male and female, use the values 1/0, or m/f, or M/F on
                                     <child>
                                       <placeholder/>
                                     </child>
+                                    <child>
+                                      <placeholder/>
+                                    </child>
                                   </widget>
                                 </child>
                               </widget>
@@ -47344,6 +47410,9 @@ It starts before and arrives there with some speed.</property>
                         <child>
                           <placeholder/>
                         </child>
+                        <child>
+                          <placeholder/>
+                        </child>
                       </widget>
                       <packing>
                         <property name="left_attach">2</property>
@@ -48199,6 +48268,9 @@ It starts before and arrives there with some speed.</property>
                     <child>
                       <placeholder/>
                     </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </widget>
                 </child>
               </widget>
@@ -49069,6 +49141,9 @@ It starts before and arrives there with some speed.</property>
                     <child>
                       <placeholder/>
                     </child>
+                    <child>
+                      <placeholder/>
+                    </child>
                   </widget>
                 </child>
               </widget>
diff --git a/src/gui/eventExecute.cs b/src/gui/eventExecute.cs
index 81c2d4e..9d6c561 100644
--- a/src/gui/eventExecute.cs
+++ b/src/gui/eventExecute.cs
@@ -557,6 +557,22 @@ public partial class ChronoJumpWindow
                
        }
        
+       private void on_button_person_max_all_sessions_info_clicked(object o, EventArgs args) 
+       {
+               if(radio_mode_jumps_small.Active) {
+                       string [] str = SqliteJump.SelectTestMaxStuff(currentPerson.UniqueID, 
currentJumpType); 
+                                       
+                       string message = string.Format(Catalog.GetString("Best {0} jump of person {1} is 
{2}\nDone at session {3} ({4})"),
+                                               currentJumpType.Name, currentPerson.Name, 
+                                               Util.TrimDecimals(Util.ChangeDecimalSeparator(str[2]), 3), 
+                                               str[1], str[0]);
+                       if(str[3] == "-1")
+                               message += "\n" + Catalog.GetString("Simulated");
+
+                       new DialogMessage(Constants.MessageTypes.INFO, message);
+               }
+       }
+       
        // Reactive jump 
        public void PrepareJumpReactiveGraph(double lastTv, double lastTc, string tvString, string tcString, 
                        bool volumeOn, RepetitiveConditionsWindow repetitiveConditionsWin) {
diff --git a/src/sqlite/jump.cs b/src/sqlite/jump.cs
index 5f89696..dd61f92 100644
--- a/src/sqlite/jump.cs
+++ b/src/sqlite/jump.cs
@@ -211,6 +211,47 @@ class SqliteJump : Sqlite
 
                return myJump;
        }
+       
+       public static string [] SelectTestMaxStuff(int personID, JumpType jumpType) 
+       {
+               double tc = 0.0;
+               if(! jumpType.StartIn)
+                       tc = 1; //just a mark meaning that tc has to be shown
+
+               double tv = 1;
+               //special cases where there's no tv
+               if(jumpType.Name == Constants.TakeOffName || jumpType.Name == Constants.TakeOffWeightName)
+                       tv = 0.0;
+       
+
+               string sqlSelect = "";
+               if(tv > 0) {
+                       if(tc <= 0)
+                               sqlSelect = "100*4.9*(jump.TV/2)*(jump.TV/2)";
+                       else
+                               sqlSelect = "jump.TV"; //if tc is higher than tv it will be fixed on 
PrepareJumpSimpleGraph
+               } else
+                       sqlSelect = "jump.TC";
+               
+               Sqlite.Open();
+               dbcmd.CommandText = "SELECT session.date, session.name, MAX(" + sqlSelect + "), 
jump.simulated " + 
+                       " FROM jump, session WHERE type = \"" + jumpType.Name + "\" AND personID = " + 
personID + 
+                       " AND jump.sessionID = session.uniqueID";
+               
+               LogB.SQL(dbcmd.CommandText.ToString());
+               dbcmd.ExecuteNonQuery();
+
+               SqliteDataReader reader;
+               reader = dbcmd.ExecuteReader();
+               reader.Read();
+               
+               string [] str = DataReaderToStringArray(reader, 4);
+               
+               reader.Close();
+               Sqlite.Close();
+
+               return str;
+       }
                
 
        public static void Update(int jumpID, string type, string tv, string tc, string fall, int personID, 
double weight, string description, double angle)


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