[chronojump] RSA better



commit 081461945486b9503f42560bd86f65a4d915fc8f
Author: Xavier de Blas <xaviblas gmail com>
Date:   Sun Jan 6 10:44:39 2013 +0100

    RSA better

 src/execute/run.cs      |   21 +++++++++++++--------
 src/gui/chronojump.cs   |    2 +-
 src/gui/eventExecute.cs |    7 ++++++-
 src/runType.cs          |    5 +++++
 src/sqlite/runType.cs   |    2 +-
 5 files changed, 26 insertions(+), 11 deletions(-)
---
diff --git a/src/execute/run.cs b/src/execute/run.cs
index e01e52b..7b136cc 100644
--- a/src/execute/run.cs
+++ b/src/execute/run.cs
@@ -489,6 +489,7 @@ public class RunIntervalExecute : RunExecute
 			distancesString = runType.DistancesString;
 		}
 
+
 		if(tracksLimited) {
 			this.limited = limitAsDouble.ToString() + "R"; //'R'uns (don't put 'T'racks for not confusing with 'T'ime)
 		} else {
@@ -765,16 +766,20 @@ public class RunIntervalExecute : RunExecute
 		double waitSeconds = Util.GetRunIVariableDistancesThisRowIsRSA(distancesString, Convert.ToInt32(tracks))
 			 - (timerCount - Util.GetTotalTime(intervalTimesString) - lastTc);
 
-		if (waitSeconds < 0 && ! RSABellDone) {
-			Util.PlaySound(Constants.SoundTypes.GOOD, volumeOn);
-			RSABellDone = true;
+		if (waitSeconds < 0) {
+		       	if(! RSABellDone) {
+				Util.PlaySound(Constants.SoundTypes.GOOD, volumeOn);
+				RSABellDone = true;
+			}
+			return Catalog.GetString("Go!");
+		} else {
+			return string.Format(Catalog.GetPluralString(
+						"Wait 1 second.",
+						"Wait {0} seconds.",
+						Convert.ToInt32(Math.Ceiling(waitSeconds))),
+					Math.Ceiling(waitSeconds));
 		}
 
-		return string.Format(Catalog.GetPluralString(
-					"Wait 1 second.",
-					"Wait {0} seconds.",
-					Convert.ToInt32(waitSeconds)),
-				Util.TrimDecimals(waitSeconds, 1));
 	}
 
 	protected override bool shouldFinishByTime() {
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index 62688ba..d6fb5f6 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -4113,7 +4113,7 @@ Console.WriteLine("X");
 						if(distanceInterval == -1) //variable distances
 							distanceInterval = Util.GetRunIVariableDistancesStringRow(
 									runType.DistancesString, (int) currentRunInterval.Tracks -1);
-
+						
 						PrepareRunIntervalGraph(distanceInterval, 
 								Util.GetLast(currentRunInterval.IntervalTimesString), 
 								currentRunInterval.IntervalTimesString, 
diff --git a/src/gui/eventExecute.cs b/src/gui/eventExecute.cs
index 177ea4d..4e1c03b 100644
--- a/src/gui/eventExecute.cs
+++ b/src/gui/eventExecute.cs
@@ -1809,13 +1809,18 @@ Log.WriteLine("Preparing reactive A");
 							currentEventExecute.PrepareEventGraphRunSimpleObject.time,
 							currentEventExecute.PrepareEventGraphRunSimpleObject.speed);
 				} else {
+					bool volumeOnHere = true;
+					//do not play good or bad sounds at RSA because we need to hear the GO sound
+					if(currentRunIntervalType.IsRSA)
+						volumeOnHere = false;
+
 					PrepareRunIntervalGraph(
 							currentEventExecute.PrepareEventGraphRunIntervalObject.distance, 
 							currentEventExecute.PrepareEventGraphRunIntervalObject.lastTime,
 							currentEventExecute.PrepareEventGraphRunIntervalObject.timesString,
 							currentEventExecute.PrepareEventGraphRunIntervalObject.distanceTotal,
 							currentEventExecute.PrepareEventGraphRunIntervalObject.distancesString,
-							volumeOn, repetitiveConditionsWin);
+							volumeOnHere, repetitiveConditionsWin);
 				}
 				break;
 			case EventType.Types.REACTIONTIME:
diff --git a/src/runType.cs b/src/runType.cs
index 2c97156..e475f6a 100644
--- a/src/runType.cs
+++ b/src/runType.cs
@@ -35,6 +35,7 @@ public class RunType : EventType
 					//	eg: "7-5-9" for a runInterval with three tracks of 7, 5 and 9 meters each
 					//	this is nice for agility tests
 	 				//	and RSA: distancesString 8-4-R3-5   means: 8m, 4m, rest 3 seconds, 5m
+					//		we know it's an RSA because there's an R in this variable
 
 	public RunType() {
 		type = Types.RUN;
@@ -497,5 +498,9 @@ public class RunType : EventType
 		get { return distancesString; }
 		set { distancesString = value; }
 	}
+
+	public bool IsRSA {
+		get { return distancesString.LastIndexOf("R") != -1; }
+	}
 }
 
diff --git a/src/sqlite/runType.cs b/src/sqlite/runType.cs
index 1b36831..4cec275 100644
--- a/src/sqlite/runType.cs
+++ b/src/sqlite/runType.cs
@@ -318,7 +318,7 @@ class SqliteRunIntervalType : SqliteRunType
 			"7m30seconds:7:0:30:0:Make max laps in 30 seconds:",	//only in more runs
 			"20m endurance:20:0:0:1:Continue running in 20m distance:",	//only in more runs
 			"MTGUG:-1:1:3:0:Modified time Getup and Go test:1-7-19",
-			"RSA 8-4-R2-5:-1:1:4:0:RSA testing:8-4-R3-5"
+			"RSA 8-4-R3-5:-1:1:4:0:RSA testing:8-4-R3-5"
 		};
 		foreach(string myString in iniRunTypes) {
 			//RunIntervalTypeInsert(myString, true);



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