[chronojump] Fixed commit: Safest finishPulsebar Select encoderSignalUniqueID



commit d97c9ea2269dfe08b15d78a30fdd0615e86ea93e
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Jul 24 01:45:09 2017 +0200

    Fixed commit: Safest finishPulsebar Select encoderSignalUniqueID

 src/gui/encoder.cs    |    8 +++++---
 src/sqlite/encoder.cs |    7 ++-----
 2 files changed, 7 insertions(+), 8 deletions(-)
---
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index b610d85..cbe8b3c 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -6364,14 +6364,16 @@ public partial class ChronoJumpWindow
                 * (2) update analyze labels and combos
                 */
 
-               EncoderSQL currentSignalSQL = (EncoderSQL) SqliteEncoder.Select(        //TODO: aixo falla si 
no tronar un EncoderSQL, pq no torna si l'acabem d'insertar?
+               ArrayList array = SqliteEncoder.Select(
                                true, Convert.ToInt32(encoderSignalUniqueID), 0, 0, getEncoderGI(),
                                -1, "", EncoderSQL.Eccons.ALL,
-                               false, true)[0];
+                               false, true);
 
-               if(currentSignalSQL.uniqueID == null)
+               if(array.Count == 0)
                        return;
 
+               EncoderSQL currentSignalSQL = (EncoderSQL) array[0];
+
                ArrayList data = SqliteEncoder.Select(
                                true, -1, currentPerson.UniqueID, currentSession.UniqueID, getEncoderGI(),
                                -1, "curve", EncoderSQL.Eccons.ALL,
diff --git a/src/sqlite/encoder.cs b/src/sqlite/encoder.cs
index 73933d2..8c94667 100644
--- a/src/sqlite/encoder.cs
+++ b/src/sqlite/encoder.cs
@@ -193,6 +193,8 @@ class SqliteEncoder : Sqlite
        
        //WARNING because SqliteEncoder.Select may not return nothing, and then cannot be assigned to eSQL
        //see: delete_encoder_curve(bool dbconOpened, int uniqueID)
+       //and: manageCurvesOfThisSignal
+       //
        //don't care for the 0, 0, 0  because selection will be based on the myUniqueID and only one row will 
be returned
        //or
        //pass uniqueID==-1 and personID, sessionID, signalOrCurve values, and will return some records
@@ -268,7 +270,6 @@ class SqliteEncoder : Sqlite
                ArrayList array = new ArrayList(1);
 
                EncoderSQL eSQL = new EncoderSQL();
-               bool added = false;
                while(reader.Read())
                {
                        string [] strFull = reader[15].ToString().Split(new char[] {':'});
@@ -315,16 +316,12 @@ class SqliteEncoder : Sqlite
                                        reader[19].ToString()                   //EncoderExercise.name
                                        );
                        array.Add (eSQL);
-                       added = true;
                }
 
                reader.Close();
                if(! dbconOpened)
                        Sqlite.Close();
 
-               if(! added)
-                       array.Add (eSQL);
-
                return array;
        }
        


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