[chronojump] Fixed a problem where runInterval with low time was saved as negative



commit 4b851972d2f1e05cb3fa43a29daf45c4e07ba41d
Author: Xavier de Blas <xaviblas gmail com>
Date:   Wed Dec 17 18:55:53 2014 +0100

    Fixed a problem where runInterval with low time was saved as negative

 src/execute/run.cs |    3 +++
 src/util.cs        |   11 +++++++++--
 2 files changed, 12 insertions(+), 2 deletions(-)
---
diff --git a/src/execute/run.cs b/src/execute/run.cs
index 7d0ddcd..46a8149 100644
--- a/src/execute/run.cs
+++ b/src/execute/run.cs
@@ -879,6 +879,9 @@ public class RunIntervalExecute : RunExecute
                                                        //this dialog can make crash the software because the 
non-gui part calls it
                                                        //new DialogMessage(Constants.MessageTypes.WARNING, 
                                                        //              Catalog.GetString("Run will not be 
recorded, 1st track is out of time"));
+
+                                                       feedbackMessage = Catalog.GetString("Run will not be 
recorded. Out of time.");
+                                                       needShowFeedbackMessage = true; 
                                                        Log.WriteLine("Run will not be recorded, 1st track is 
out of time");
        
                                                        //mark for not having problems with cancelled
diff --git a/src/util.cs b/src/util.cs
index 127c459..9c0eda0 100644
--- a/src/util.cs
+++ b/src/util.cs
@@ -508,7 +508,9 @@ public class Util
        public static bool EventPassedFromMaxTime(
                        string timesString, double timeLimit) 
        {
-               if(Util.GetTotalTime(timesString) > timeLimit) 
+               //Absolute value because timesString can start with a '-' if run limited by time and
+               //first subRun has arrived later than maximum for the whole run
+               if(Math.Abs(Util.GetTotalTime(timesString)) > timeLimit) 
                        return true;    //eventsTime are higher than timeLimit: one ore more exceeds 
                else
                        return false;   //eventsTime are lower than timeLimit: no problem
@@ -535,7 +537,12 @@ public class Util
                        //imagine a runInterval where we only have 10 seconds for go, return, go... n times. 
And imagine, going is like 20 seconds, then 
                        //runInterval write will try to delete last subEvent, but this is the only one
                        //then return the time in negative (-) as a mark, and caller will show the time late 
in a popup win
-                       return "-" + myString;
+               
+                       //but maybe the mark has added first because this was called on tempTable iteration 
and later on final SQL write iteration
+                       if( ! myString.StartsWith("-") )
+                               myString = "-" + myString;
+                               
+                       return myString;
        }
 
 


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