[chronojump] LoadAllSessionsTestsCount no longer returns string []. Now return List<class SessionTestsCount>



commit 426240e6c82f71f04be205b49cb4a4e960c8ceaa
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed Jun 1 16:47:43 2022 +0200

    LoadAllSessionsTestsCount no longer returns string []. Now return List<class SessionTestsCount>

 src/gui/app1/session/export.cs        |  27 ++--
 src/gui/app1/session/loadAndImport.cs |  51 ++++---
 src/session.cs                        |  55 +++++++-
 src/sqlite/session.cs                 | 257 +++++++++-------------------------
 4 files changed, 155 insertions(+), 235 deletions(-)
---
diff --git a/src/gui/app1/session/export.cs b/src/gui/app1/session/export.cs
index 74b121a60..5c26d20a3 100644
--- a/src/gui/app1/session/export.cs
+++ b/src/gui/app1/session/export.cs
@@ -15,7 +15,7 @@
  *  along with this program; if not, write to the Free Software
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- * Copyright (C) 2020   Xavier de Blas <xaviblas gmail com> 
+ * Copyright (C) 2022   Xavier de Blas <xaviblas gmail com>
  */
 
 using System;
@@ -228,33 +228,22 @@ public partial class ChronoJumpWindow
                SqliteSessionSwitcher sessionSwitcher = new SqliteSessionSwitcher
                        (SqliteSessionSwitcher.DatabaseType.EXPORT, exportedDB);
 
-               /*
-                * TODO (optional): use this to have objects intead of strings []
-               List<Session> session_l = SqliteSession.SelectAll();
-               foreach(Session session in session_l)
-                       if(session.UniqueID != currentSession.UniqueID)
-                               SqliteSession.DeleteAllStuff(session.UniqueID.ToString());
-                               */
-
-               string [] mySessions = sessionSwitcher.SelectAllSessionsTestsCount (""); //returns a string 
of values separated by ':'
+               List<SessionTestsCount> stc_l = sessionSwitcher.SelectAllSessionsTestsCount (""); //returns a 
string of values separated by ':'
 
                int count = 1;
-               foreach (string session in mySessions)
+               foreach (SessionTestsCount stc in stc_l)
                {
                        //cancelExport breaks here instead doing it on pulse to avoid leaving some Sqlite 
DataReader opened
                        if(cancelExport)
                                break;
 
-                       app1s_exportText = string.Format("Adjusting new database {0}/{1}", count, 
mySessions.Length);
-                       LogB.Information(string.Format("session: {0}", session));
-                       string [] myStringFull = session.Split(new char[] {':'});
-                       string sessionID = myStringFull[0];
-                       if(sessionID != currentSession.UniqueID.ToString())
+                       app1s_exportText = string.Format("Adjusting new database {0}/{1}", count, 
stc_l.Count);
+                       if(stc.sessionParams.ID != currentSession.UniqueID)
                        {
-                               LogB.Information(string.Format("session: {0}, will be deleted", sessionID));
-                               sessionSwitcher.DeleteAllStuff(sessionID);
+                               LogB.Information(string.Format("session: {0}, will be deleted", 
stc.sessionParams.ID));
+                               sessionSwitcher.DeleteAllStuff(stc.sessionParams.ID.ToString ());
                        }
-                       LogB.Information(string.Format("export session {0}/{1} done!", count, 
mySessions.Length ));
+                       LogB.Information(string.Format("export session {0}/{1} done!", count, stc_l.Count ));
                        count ++;
                }
 
diff --git a/src/gui/app1/session/loadAndImport.cs b/src/gui/app1/session/loadAndImport.cs
index ec0f635b4..cfd9b5c5e 100644
--- a/src/gui/app1/session/loadAndImport.cs
+++ b/src/gui/app1/session/loadAndImport.cs
@@ -481,7 +481,7 @@ public partial class ChronoJumpWindow
                }
                SqliteSessionSwitcher sessionSwitcher = new SqliteSessionSwitcher (databaseType, 
app1s_import_file_path);
                
-               string [] mySessions = sessionSwitcher.SelectAllSessionsTestsCount (filterName); //returns a 
string of values separated by ':'
+               List<SessionTestsCount> stc_l = sessionSwitcher.SelectAllSessionsTestsCount (filterName); 
//returns a string of values separated by ':'
 
                //new 2.0 code
                int columns = 6;
@@ -512,38 +512,35 @@ public partial class ChronoJumpWindow
                        columns ++;
                }
 
-               foreach (string session in mySessions)
+               foreach (SessionTestsCount stc in stc_l)
                {
-                       string [] myStringFull = session.Split(new char[] {':'});
-               
                        //don't show any text at sport, speciallity and level if it's undefined 
                        string mySport = "";
-                       if (myStringFull[4] != Catalog.GetString(Constants.SportUndefined)) 
-                               mySport = Catalog.GetString(myStringFull[4]);
+                       if (stc.sessionParams.SportName != Catalog.GetString(Constants.SportUndefined))
+                               mySport = stc.sessionParams.SportName;
 
                        string mySpeciallity = ""; //done also because Undefined has "" as name and crashes 
with gettext
-                       if (myStringFull[5] != "") 
-                               mySpeciallity = Catalog.GetString(myStringFull[5]);
+                       if (stc.sessionParams.SpeciallityName != "")
+                               mySpeciallity = stc.sessionParams.SpeciallityName;
                        
                        string myLevel = "";
-                       if (myStringFull[6] != Catalog.GetString(Constants.LevelUndefined)) 
-                               myLevel = Catalog.GetString(myStringFull[6]);
+                       if (stc.sessionParams.LevelName != Catalog.GetString(Constants.LevelUndefined))
+                               myLevel = stc.sessionParams.LevelName;
 
                        string [] strings = new string [columns];
                        //for (int i=0; i < columns; i++) {
                        //      types[i] = typeof (string);
                        //}
                        int i = 0;
-                       strings[i ++] = myStringFull[0];        //session num
-                       strings[i ++] = myStringFull[3];        //session date
-                       strings[i ++] = myStringFull[1];        //session name
+                       strings[i ++] = stc.sessionParams.ID.ToString();
+                       strings[i ++] = stc.sessionParams.Date;
+                       strings[i ++] = stc.sessionParams.Name;
 
                        //to show tag column
                        if (app1s_type == app1s_windowType.LOAD_SESSION)
                        {
                                List<TagSession> tagSession_list = SessionTagSession.FindTagSessionsOfSession(
-                                               Convert.ToInt32(myStringFull[0]),
-                                               tagsOfAllSessions);
+                                               stc.sessionParams.ID, tagsOfAllSessions);
                                strings[i ++] = SessionTagSession.PrintTagNamesOfSession(tagSession_list);
 
                                //do not show this session depending on tags
@@ -559,8 +556,8 @@ public partial class ChronoJumpWindow
                                }
                        }
 
-                       strings[i ++] = myStringFull[2];        //session place
-                       strings[i ++] = myStringFull[8];        //number of jumpers x session
+                       strings[i ++] = stc.sessionParams.Place;
+                       strings[i ++] = stc.Persons.ToString (); // persons x session
 
                        if(showPersons) {
                                strings[i ++] = mySport;                //personsSport
@@ -568,20 +565,22 @@ public partial class ChronoJumpWindow
                                strings[i ++] = myLevel;                //personsLevel
                        }
                        if(showJumps) {
-                               strings[i ++] = myStringFull[9];        //number of jumps x session
-                               strings[i ++] = myStringFull[10];       //number of jumpsRj x session
+                               strings[i ++] = stc.JumpsSimple.ToString ();
+                               strings[i ++] = stc.JumpsReactive.ToString ();
                        }
                        if(showRuns) {
-                               strings[i ++] = myStringFull[11];       //number of runs x session
-                               strings[i ++] = myStringFull[12];       //number of runsInterval x session
-                               strings[i ++] = myStringFull[19];       //number of runEncoder
+                               strings[i ++] = stc.RunsSimple.ToString ();
+                               strings[i ++] = stc.RunsInterval.ToString ();
+                               strings[i ++] = stc.RunsEncoder.ToString ();
                        }
                        if (showForceSensor)
-                               strings[i ++] = myStringFull[18];       //number of forceSensor
+                               strings[i ++] = stc.ForceSensor.ToString ();
                        if (showWeights)
-                               strings[i ++] = myStringFull[16];       //number of encoder signal x session
+                               strings[i ++] = string.Format ("{0} ; {1}",
+                                               stc.WeightsSets, stc.WeightsReps); //number of encoder grav 
signal,reps x session
                        if (showInertial)
-                               strings[i ++] = myStringFull[17];       //number of encoder curve x session
+                               strings[i ++] = string.Format ("{0} ; {1}",
+                                               stc.InertialSets, stc.InertialReps); //number of encoder 
inertial signal,reps x session
                        /*
                        if(showRT) {
                                strings[i ++] = myStringFull[13];       //number of reaction times x session
@@ -591,7 +590,7 @@ public partial class ChronoJumpWindow
                                strings[i ++] = myStringFull[15];       //number of multiChronopics x session
                        }
                        */
-                       strings[i ++] = myStringFull[7];                //description of session (comments)
+                       strings[i ++] = stc.sessionParams.Description;
 
                        app1s_store.AppendValues (strings);
                }       
diff --git a/src/session.cs b/src/session.cs
index 52457789f..87afc2587 100644
--- a/src/session.cs
+++ b/src/session.cs
@@ -15,7 +15,7 @@
  *  along with this program; if not, write to the Free Software
  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  *
- *  Copyright (C) 2004-2017   Xavier de Blas <xaviblas gmail com> 
+ *  Copyright (C) 2004-2022   Xavier de Blas <xaviblas gmail com>
  */
 
 using System;
@@ -289,3 +289,56 @@ public class ServerSession : Session
 
 }
 
+/*
+   SqliteSessionSwitcher and SqliteSession SelectAllSessions, returns a list of this
+   instead of old string []
+   */
+public class SessionTestsCount
+{
+       public SessionParams sessionParams;
+
+       public int Persons;
+       public int JumpsSimple;
+       public int JumpsReactive;
+       public int RunsSimple;
+       public int RunsInterval;
+       public int RunsEncoder;
+       public int ForceSensor;
+       public int WeightsSets;
+       public int WeightsReps;
+       public int InertialSets;
+       public int InertialReps;
+
+       public int ReactionTimeOld;
+       public int Pulses;
+       public int MultiChronopic;
+
+       public SessionTestsCount ()
+       {
+       }
+}
+public class SessionParams
+{
+       public int ID;
+       public string Name;
+       public string Place;
+       public string Date;
+       public string SportName;
+       public string SpeciallityName;
+       public string LevelName;
+       public string Description;
+
+       public SessionParams (int ID, string Name, string Place, string Date,
+                       string SportName, string SpeciallityName,
+                       string LevelName, string Description)
+       {
+               this.ID = ID;
+               this.Name = Name;
+               this.Place = Place;
+               this.Date = Date;
+               this.SportName = SportName;
+               this.SpeciallityName = SpeciallityName;
+               this.LevelName = LevelName;
+               this.Description = Description;
+       }
+}
diff --git a/src/sqlite/session.cs b/src/sqlite/session.cs
index 8eaa96043..c479b2e0e 100644
--- a/src/sqlite/session.cs
+++ b/src/sqlite/session.cs
@@ -57,8 +57,7 @@ public class SqliteSessionSwitcher
                this.databasePath = databasePath;
        }
 
-       public string[] SelectAllSessionsTestsCount (string filterName)
-       //public List<SessionTestsCount> SelectAllSessions (string filterName)
+       public List<SessionTestsCount> SelectAllSessionsTestsCount (string filterName)
        {
                if (type == DatabaseType.DEFAULT)
                {
@@ -67,26 +66,24 @@ public class SqliteSessionSwitcher
                else
                {
                        SqliteGeneral sqliteGeneral = new SqliteGeneral(databasePath);
-                       if (! sqliteGeneral.IsOpened) {
-                               List<string> emptyResult = new List<string> ();
-                               return emptyResult.ToArray ();
-                               //return new List<SessionTestsCount> ();
-                       }
+                       if (! sqliteGeneral.IsOpened)
+                               return new List<SessionTestsCount> ();
+
                        SqliteConnection dbcon = sqliteGeneral.connection;
 
-                       string[] allSessions = SqliteSession.SelectAllSessionsTestsCount (filterName, dbcon);
+                       List<SessionTestsCount> allSessions_l = SqliteSession.SelectAllSessionsTestsCount 
(filterName, dbcon);
 
                        // on IMPORT, filtered sessions will contain all sessions but not the "SIMULATED"
-                       List<string> filteredSessions = new List<string> ();
-                       foreach(string session in allSessions)
+                       List<SessionTestsCount> stc_l = new List<SessionTestsCount> ();
+                       foreach(SessionTestsCount stc in allSessions_l)
                        {
-                               if (type == DatabaseType.IMPORT && session.Split (':') [1] == "SIMULATED")
+                               if (type == DatabaseType.IMPORT && stc.sessionParams.Name == "SIMULATED")
                                        continue;
 
-                               filteredSessions.Add (session);
+                               stc_l.Add (stc);
                        }
 
-                       return filteredSessions.ToArray();
+                       return stc_l;
                }
        }
 
@@ -380,27 +377,26 @@ class SqliteSession : Sqlite
        }
 
        // It's used by chronojump-importer and receives a specific database
-       public static string[] SelectAllSessionsTestsCount (string filterName, SqliteConnection dbcon)
+       public static List<SessionTestsCount> SelectAllSessionsTestsCount (string filterName, 
SqliteConnection dbcon)
        {
-               string [] mySessions = selectAllSessionsTestsCountDo (filterName, dbcon);
-               return mySessions;
+               return selectAllSessionsTestsCountDo (filterName, dbcon);
        }
 
        // This is the usual chronojump's call (default database)
-       public static string[] SelectAllSessionsTestsCount (string filterName)
+       public static List<SessionTestsCount> SelectAllSessionsTestsCount (string filterName)
        {
                Sqlite.Open();
 
-               // SelectAllSessionsTestCount is used here and by the Chronojump importer to allow to pass an 
arbitrary
-               // dbcon.
-               string [] mySessions = selectAllSessionsTestsCountDo (filterName, dbcon);
+               // SelectAllSessionsTestCount is used here and by the Chronojump importer to allow to pass an 
arbitrary dbcon.
+               List<SessionTestsCount> stc_l = selectAllSessionsTestsCountDo (filterName, dbcon);
 
                //close database connection
                Sqlite.Close();
 
-               return mySessions;
+               return stc_l;
        }
-       private static string[] selectAllSessionsTestsCountDo (string filterName, SqliteConnection dbcon)
+
+       private static List<SessionTestsCount> selectAllSessionsTestsCountDo (string filterName, 
SqliteConnection dbcon)
        {
                // This method should NOT use Sqlite.open() / Sqlite.close(): it should only use dbcon
                // to connect to the database. This method is used by the importer after opening an arbitrary
@@ -424,10 +420,7 @@ class SqliteSession : Sqlite
 
                SqliteDataReader reader;
                reader = dbcmd.ExecuteReader();
-               ArrayList myArray = new ArrayList(2);
-
-               int count = new int();
-               count = 0;
+               List<SessionParams> sessionParams_l = new List<SessionParams> ();
 
                while(reader.Read()) {
                        string sportName = Catalog.GetString(reader[9].ToString());
@@ -435,11 +428,17 @@ class SqliteSession : Sqlite
                        if(reader[10].ToString() != "")
                                speciallityName = Catalog.GetString(reader[10].ToString());
                        string levelName = Catalog.GetString(Util.FindLevelName(Convert.ToInt32(reader[6])));
-                       myArray.Add (reader[0].ToString() + ":" + reader[1].ToString() + ":" +
-                                    reader[2].ToString() + ":" + 
UtilDate.FromSql(reader[3].ToString()).ToShortDateString() + ":" +
-                                    sportName + ":" + speciallityName + ":" +
-                                    levelName + ":" + reader[7].ToString() ); //desc
-                       count ++;
+
+                       sessionParams_l.Add (new SessionParams (
+                                               Convert.ToInt32 (reader[0].ToString()),
+                                               reader[1].ToString(),
+                                               reader[2].ToString(),
+                                               UtilDate.FromSql(reader[3].ToString()).ToShortDateString(),
+                                               sportName,
+                                               speciallityName,
+                                               levelName,
+                                               reader[7].ToString() //desc
+                                               ));
                }
 
                reader.Close();
@@ -672,172 +671,52 @@ class SqliteSession : Sqlite
                        reader_re.Close();
                }
 
-               //mix ten arrayLists
-               string [] mySessions = new string[count];
-               count =0;
-               bool found;
-               string result_enc_s;    //sets
-               string result_enc_r;    //repetitions
-               foreach (string line in myArray) {
-                       string lineNotReadOnly = line;
+               //mix all arrayLists
+               List<SessionTestsCount> stc_l = new List<SessionTestsCount> ();
+               foreach (SessionParams sessionParam in sessionParams_l)
+               {
+                       SessionTestsCount stc = new SessionTestsCount ();
 
                        //if some sessions are deleted, do not use count=0 to mix arrays, use sessionID of 
line
-                       string [] mixingSessionFull = line.Split(new char[] {':'});
-                       string mixingSessionID = mixingSessionFull[0];
-
-                       //add persons for each session  
-                       found = false;
-                       foreach (string line_persons in myArray_persons) {
-                               string [] myStringFull = line_persons.Split(new char[] {':'});
-                               if(myStringFull[0] == mixingSessionID) {
-                                       lineNotReadOnly  = lineNotReadOnly + ":" + myStringFull[1];
-                                       found = true;
-                               }
-                       }
-                       if (!found) { lineNotReadOnly  = lineNotReadOnly + ":0"; }
-
-                       //add jumps for each session
-                       found = false;
-                       foreach (string line_jumps in myArray_jumps) {
-                               string [] myStringFull = line_jumps.Split(new char[] {':'});
-                               if(myStringFull[0] == mixingSessionID) {
-                                       lineNotReadOnly  = lineNotReadOnly + ":" + myStringFull[1];
-                                       found = true;
-                               }
-                       }
-                       if (!found) { lineNotReadOnly  = lineNotReadOnly + ":0"; }
-
-                       //add jumpsRj for each session
-                       found = false;
-                       foreach (string line_jumpsRj in myArray_jumpsRj) {
-                               string [] myStringFull = line_jumpsRj.Split(new char[] {':'});
-                               if(myStringFull[0] == mixingSessionID) {
-                                       lineNotReadOnly  = lineNotReadOnly + ":" + myStringFull[1];
-                                       found = true;
-                               }
-                       }
-                       if (!found) { lineNotReadOnly  = lineNotReadOnly + ":0"; }
-
-                       //add runs for each session
-                       found = false;
-                       foreach (string line_runs in myArray_runs) {
-                               string [] myStringFull = line_runs.Split(new char[] {':'});
-                               if(myStringFull[0] == mixingSessionID) {
-                                       lineNotReadOnly  = lineNotReadOnly + ":" + myStringFull[1];
-                                       found = true;
-                               }
-                       }
-                       if (!found) { lineNotReadOnly  = lineNotReadOnly + ":0"; }
-
-                       //add runsInterval for each session
-                       found = false;
-                       foreach (string line_runs_interval in myArray_runs_interval) {
-                               string [] myStringFull = line_runs_interval.Split(new char[] {':'});
-                               if(myStringFull[0] == mixingSessionID) {
-                                       lineNotReadOnly  = lineNotReadOnly + ":" + myStringFull[1];
-                                       found = true;
-                               }
-                       }
-                       if (!found) { lineNotReadOnly  = lineNotReadOnly + ":0"; }
-
-                       //add reaction time for each session
-                       found = false;
-                       foreach (string line_rt in myArray_rt) {
-                               string [] myStringFull = line_rt.Split(new char[] {':'});
-                               if(myStringFull[0] == mixingSessionID) {
-                                       lineNotReadOnly  = lineNotReadOnly + ":" + myStringFull[1];
-                                       found = true;
-                               }
-                       }
-                       if (!found) { lineNotReadOnly  = lineNotReadOnly + ":0"; }
-
-                       //add pulses for each session
-                       found = false;
-                       foreach (string line_pulses in myArray_pulses) {
-                               string [] myStringFull = line_pulses.Split(new char[] {':'});
-                               if(myStringFull[0] == mixingSessionID) {
-                                       lineNotReadOnly  = lineNotReadOnly + ":" + myStringFull[1];
-                                       found = true;
-                               }
-                       }
-                       if (!found) { lineNotReadOnly  = lineNotReadOnly + ":0"; }
-
-                       //add multiChronopic for each session
-                       found = false;
-                       foreach (string line_mcs in myArray_mcs) {
-                               string [] myStringFull = line_mcs.Split(new char[] {':'});
-                               if(myStringFull[0] == mixingSessionID) {
-                                       lineNotReadOnly  = lineNotReadOnly + ":" + myStringFull[1];
-                                       found = true;
-                               }
-                       }
-                       if (!found) { lineNotReadOnly  = lineNotReadOnly + ":0"; }
-
-                       //add encoder gravitatory for each session (sets ; repetitions)
-                       result_enc_s = "0";
-                       result_enc_r = "0";
-                       foreach (string line_enc_g_s in myArray_enc_g_s) {
-                               string [] myStringFull = line_enc_g_s.Split(new char[] {':'});
-                               if(myStringFull[0] == mixingSessionID)
-                                       result_enc_s = myStringFull[1];
-                       }
-                       foreach (string line_enc_g_r in myArray_enc_g_r) {
-                               string [] myStringFull = line_enc_g_r.Split(new char[] {':'});
-                               if(myStringFull[0] == mixingSessionID)
-                                       result_enc_r = myStringFull[1];
-                       }
-                       lineNotReadOnly  = lineNotReadOnly + ":" + result_enc_s + " ; " + result_enc_r;
-
-                       //add encoder inertial for each session (sets ; repetitions)
-                       result_enc_s = "0";
-                       result_enc_r = "0";
-                       foreach (string line_enc_i_s in myArray_enc_i_s) {
-                               string [] myStringFull = line_enc_i_s.Split(new char[] {':'});
-                               if(myStringFull[0] == mixingSessionID)
-                                       result_enc_s = myStringFull[1];
-                       }
-                       foreach (string line_enc_i_r in myArray_enc_i_r) {
-                               string [] myStringFull = line_enc_i_r.Split(new char[] {':'});
-                               if(myStringFull[0] == mixingSessionID)
-                                       result_enc_r = myStringFull[1];
-                       }
-                       lineNotReadOnly  = lineNotReadOnly + ":" + result_enc_s + " ; " + result_enc_r;
-
-                       //add force sensor for each session
-                       found = false;
-                       foreach (string line_fs in myArray_fs) {
-                               string [] myStringFull = line_fs.Split(new char[] {':'});
-                               if(myStringFull[0] == mixingSessionID) {
-                                       lineNotReadOnly  = lineNotReadOnly + ":" + myStringFull[1];
-                                       found = true;
-                               }
-                       }
-                       if (!found) { lineNotReadOnly  = lineNotReadOnly + ":0"; }
-
-                       //add run encoder for each session
-                       found = false;
-                       foreach (string line_re in myArray_re) {
-                               string [] myStringFull = line_re.Split(new char[] {':'});
-                               if(myStringFull[0] == mixingSessionID) {
-                                       lineNotReadOnly  = lineNotReadOnly + ":" + myStringFull[1];
-                                       found = true;
-                               }
-                       }
-                       if (!found) { lineNotReadOnly  = lineNotReadOnly + ":0"; }
-
-                       mySessions [count++] = lineNotReadOnly;
+                       //string [] mixingSessionFull = line.Split(new char[] {':'});
+                       //string mixingSessionID = mixingSessionFull[0];
+
+                       stc.sessionParams = sessionParam;
+                       int sID = stc.sessionParams.ID;
+
+                       stc.Persons = getTestsInTable (myArray_persons, sID);
+                       stc.JumpsSimple = getTestsInTable (myArray_jumps, sID);
+                       stc.JumpsReactive = getTestsInTable (myArray_jumpsRj, sID);
+                       stc.RunsSimple = getTestsInTable (myArray_runs, sID);
+                       stc.RunsInterval = getTestsInTable (myArray_runs_interval, sID);
+                       stc.RunsEncoder = getTestsInTable (myArray_re, sID);
+                       stc.ForceSensor = getTestsInTable (myArray_fs, sID);
+                       stc.WeightsSets = getTestsInTable (myArray_enc_g_s, sID);
+                       stc.WeightsReps = getTestsInTable (myArray_enc_g_r, sID);
+                       stc.InertialSets = getTestsInTable (myArray_enc_i_s, sID);
+                       stc.InertialReps = getTestsInTable (myArray_enc_i_r, sID);
+                       stc.ReactionTimeOld = getTestsInTable (myArray_rt, sID);
+                       stc.Pulses = getTestsInTable (myArray_pulses, sID);
+                       stc.MultiChronopic = getTestsInTable (myArray_mcs, sID);
+
+                       //mySessions [count++] = lineNotReadOnly;
+                       stc_l.Add (stc);
                }
 
-               if (mySessions.Length > 0) {
-                       LogB.SQL (mySessions [0]);
-               } else {
-                       LogB.Debug ("SelectAllSessionsTestsCount with filter: " + filterName + " is empty");
+               return stc_l;
+       }
+       private static int getTestsInTable (ArrayList array, int sessionID)
+       {
+               foreach (string str in array)
+               {
+                       string [] stringFull = str.Split (new char[] {':'});
+                       if (Convert.ToInt32 (stringFull[0]) == sessionID)
+                               return Convert.ToInt32 (stringFull [1]);
                }
-               return mySessions;
+               return 0;
        }
 
 
-
        //called from gui/event.cs for doing the graph
        //we need to know the avg of events of a type (SJ, CMJ, free (pulse).. of a person, or of all persons 
on the session
        //from 2.0 type can be "" so all types


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