[chronojump] On recalculate if exercise changed, related curves are deleted



commit cc105eff9a0c0a2a0357dd52b69e5cc7f65616a4
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Mar 10 14:08:07 2015 +0100

    On recalculate if exercise changed, related curves are deleted

 src/gui/encoder.cs |   25 +++++++++++++++----------
 1 files changed, 15 insertions(+), 10 deletions(-)
---
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index f922cdc..2f31e05 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -5488,10 +5488,13 @@ LogB.Debug("D");
 
                                        /*
                                         * (1) if found curves of this signal
-                                        * (2) and this curves are with different eccon
-                                        * (3) delete the curves (encoder table)
-                                        * (4) and also delete from (encoderSignalCurves table)
-                                        * (5) update analyze labels and combos
+                                        * (2) and this curves are with 
+                                        *      different eccon OR
+                                        *      different exercise
+                                        * (3) delete the curves (files)
+                                        * (4) delete the curves (encoder table)
+                                        * (5) and also delete from (encoderSignalCurves table)
+                                        * (6) update analyze labels and combos
                                         */
                                        bool deletedUserCurves = false;
                                        EncoderSQL currentSignalSQL = (EncoderSQL) SqliteEncoder.Select(
@@ -5507,14 +5510,16 @@ LogB.Debug("D");
                                        foreach(EncoderSQL eSQL in data) {
                                                if(
                                                                currentSignalSQL.GetDate(false) == 
eSQL.GetDate(false) &&               // (1)
-                                                               findEccon(true) != eSQL.eccon) {              
                          // (2)
-                                                                       Sqlite.Delete(false, 
Constants.EncoderTable, Convert.ToInt32(eSQL.uniqueID));   // (3)
-                                                                       
SqliteEncoder.DeleteSignalCurveWithCurveID(false, Convert.ToInt32(eSQL.uniqueID)); // (4)
-                                                                       deletedUserCurves = true;
-                                                               }
+                                                               (findEccon(true) != eSQL.eccon || 
currentSignalSQL.exerciseID != eSQL.exerciseID) // (2)
+                                                               ) {
+                                                       Util.FileDelete(eSQL.GetFullURL(false));              
                          // (3)
+                                                       Sqlite.Delete(false, Constants.EncoderTable, 
Convert.ToInt32(eSQL.uniqueID));   // (4)
+                                                       SqliteEncoder.DeleteSignalCurveWithCurveID(false, 
Convert.ToInt32(eSQL.uniqueID)); // (5)
+                                                       deletedUserCurves = true;
+                                               }
                                        }
                                        if(deletedUserCurves)
-                                               updateUserCurvesLabelsAndCombo(false);          // (5)
+                                               updateUserCurvesLabelsAndCombo(false);          // (6)
 
 
                                        findAndMarkSavedCurves();


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