[chronojump] ShowAllPersonsEvents show also runEncoder



commit eb6ea9a916402fbf41291b6920fc261a20d99024
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Oct 8 10:43:05 2019 +0200

    ShowAllPersonsEvents show also runEncoder

 src/gui/person.cs    |  7 ++++---
 src/sqlite/person.cs | 26 +++++++++++++++++++++++++-
 2 files changed, 29 insertions(+), 4 deletions(-)
---
diff --git a/src/gui/person.cs b/src/gui/person.cs
index d7f3ee79..7d415972 100644
--- a/src/gui/person.cs
+++ b/src/gui/person.cs
@@ -2596,7 +2596,7 @@ public class PersonShowAllEventsWindow
                createTreeView(treeview_person_show_all_events);
                store = new TreeStore( typeof (string), typeof (string), typeof (string), typeof (string), 
                                typeof (string), typeof(string), typeof(string), typeof(string), 
typeof(string), typeof(string),
-                               typeof (string), typeof (string), typeof(string));
+                               typeof (string), typeof (string), typeof(string), typeof(string));
                treeview_person_show_all_events.Model = store;
                fillTreeView(treeview_person_show_all_events,store, currentPerson.UniqueID);
        }
@@ -2654,7 +2654,7 @@ public class PersonShowAllEventsWindow
                if(myText != "") {
                        store = new TreeStore( typeof (string), typeof (string), typeof (string), typeof 
(string), 
                                        typeof (string), typeof(string), typeof(string), typeof(string), 
typeof(string), typeof(string),
-                                       typeof (string), typeof (string), typeof(string));
+                                       typeof (string), typeof (string), typeof(string), typeof(string));
                        treeview_person_show_all_events.Model = store;
                        
                        string [] myStringFull = myText.Split(new char[] {':'});
@@ -2689,6 +2689,7 @@ public class PersonShowAllEventsWindow
                tv.AppendColumn ( Catalog.GetString ("Encoder sets"), new CellRendererText(), "text", 
count++);
                tv.AppendColumn ( Catalog.GetString ("Encoder repetitions"), new CellRendererText(), "text", 
count++);
                tv.AppendColumn ( Catalog.GetString ("Force sensor"), new CellRendererText(), "text", 
count++);
+               tv.AppendColumn ( Catalog.GetString ("Run encoder"), new CellRendererText(), "text", count++);
        }
        
        protected void fillTreeView (Gtk.TreeView tv, TreeStore store, int personID) {
@@ -2699,7 +2700,7 @@ public class PersonShowAllEventsWindow
                        string [] myStr = myEvent.Split(new char[] {':'});
 
                        store.AppendValues (myStr[0], myStr[1], myStr[2], myStr[3], myStr[4], myStr[5], 
-                                       myStr[6], myStr[7], myStr[8], myStr[9], myStr[10], myStr[11], 
myStr[12]);
+                                       myStr[6], myStr[7], myStr[8], myStr[9], myStr[10], myStr[11], 
myStr[12], myStr[13]);
                }
        }
 
diff --git a/src/sqlite/person.cs b/src/sqlite/person.cs
index ee202994..10823164 100644
--- a/src/sqlite/person.cs
+++ b/src/sqlite/person.cs
@@ -294,6 +294,7 @@ finishForeach:
                ArrayList arrayEncS = new ArrayList(2);
                ArrayList arrayEncC = new ArrayList(2);
                ArrayList arrayForce = new ArrayList(2);
+               ArrayList arrayRunEncoder = new ArrayList(2);
                
                string tps = Constants.PersonSessionTable;
        
@@ -430,6 +431,17 @@ finishForeach:
                }
                reader.Close();
 
+               //runEncoder
+               dbcmd.CommandText = "SELECT sessionID, count(*) FROM " + Constants.RunEncoderTable + " WHERE 
personID = " + personID +
+                       " GROUP BY sessionID ORDER BY sessionID";
+               LogB.SQL(dbcmd.CommandText.ToString());
+
+               reader = dbcmd.ExecuteReader();
+               while(reader.Read()) {
+                       arrayRunEncoder.Add ( reader[0].ToString() + ":" + reader[1].ToString() );
+               }
+               reader.Close();
+
 
 
                Sqlite.Close();
@@ -446,6 +458,7 @@ finishForeach:
                string tempEncS;
                string tempEncC;
                string tempForce;
+               string tempRunEncoder;
                bool found;     //using found because a person can be loaded in a session 
                                //but whithout having done any event yet
 
@@ -462,6 +475,7 @@ finishForeach:
                        tempEncS = "";
                        tempEncC = "";
                        tempForce = "";
+                       tempRunEncoder = "";
                        found = false;
                        
                        foreach (string myJumps in arrayJumps) {
@@ -554,6 +568,15 @@ finishForeach:
                                }
                        }
 
+                       foreach (string re in arrayRunEncoder) {
+                               string [] myStr = re.Split(new char[] {':'});
+                               if(myStrSession[0] == myStr[0]) {
+                                       tempRunEncoder = myStr[1];
+                                       found = true;
+                                       break;
+                               }
+                       }
+
 
                        //if has events, write it's data
                        if (found) {
@@ -562,7 +585,8 @@ finishForeach:
                                                tempJumpsRj + ":" + tempRuns + ":" +            //jumpsRj, 
Runs
                                                tempRunsInterval + ":" + tempRTs + ":" +        
//runsInterval, Reaction times
                                                tempPulses + ":" + tempMCs + ":" +              //pulses, 
MultiChronopic
-                                               tempEncS + ":" + tempEncC + ":" + tempForce     //encoder 
signal, encoder curve, forceSensor
+                                               tempEncS + ":" + tempEncC + ":" +               //encoder 
signal, encoder curve
+                                               tempForce + ":" + tempRunEncoder                
//forceSensor, runEncoder
                                                );
                        }
                }


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