[chronojump] done: 635599 - Difference between tests stats



commit 3fe7255839c9e47393c5131213e3480043fafe78
Author: Xavier de Blas <xaviblas gmail com>
Date:   Tue Feb 22 18:06:38 2011 +0100

    done: 635599 - Difference between tests stats

 src/gui/stats.cs                          |   43 +++++++++++++++-------------
 src/report.cs                             |    2 +-
 src/sqlite/stat.cs                        |   15 ++++++----
 src/stats/graphs/ieIub.cs                 |    4 +-
 src/stats/graphs/jumpSimpleSubtraction.cs |   34 +++++++++++++----------
 src/stats/jumpSimpleSubtraction.cs        |   16 ++++++-----
 6 files changed, 63 insertions(+), 51 deletions(-)
---
diff --git a/src/gui/stats.cs b/src/gui/stats.cs
index 8910e30..4bbfcdb 100644
--- a/src/gui/stats.cs
+++ b/src/gui/stats.cs
@@ -359,13 +359,13 @@ public class StatsWindow {
 	
 	private void createComboStatsSubtractionBetweenTests() {
 		combo_subtraction_between_1 = ComboBox.NewText ();
-		combo_subtraction_between_1.Changed += new EventHandler (on_combo_subtraction_between_1_changed);
+		combo_subtraction_between_1.Changed += new EventHandler (on_combo_subtraction_between_1_or_2_changed);
 		hbox_subtraction_between_1.PackStart(combo_subtraction_between_1, true, true, 0);
 		hbox_subtraction_between_1.ShowAll();
 		combo_subtraction_between_1.Sensitive = true;
 		
 		combo_subtraction_between_2 = ComboBox.NewText ();
-		combo_subtraction_between_2.Changed += new EventHandler (on_combo_subtraction_between_2_changed);
+		combo_subtraction_between_2.Changed += new EventHandler (on_combo_subtraction_between_1_or_2_changed);
 		hbox_subtraction_between_2.PackStart(combo_subtraction_between_2, true, true, 0);
 		hbox_subtraction_between_2.ShowAll();
 		combo_subtraction_between_2.Sensitive = true;
@@ -745,12 +745,16 @@ public class StatsWindow {
 	
 		string statisticType = UtilGtk.ComboGetActive(combo_stats_stat_type);
 		string statisticSubType = UtilGtk.ComboGetActive(combo_stats_stat_subtype);
-		string statisticApplyTo = UtilGtk.ComboGetActive(combo_stats_stat_apply_to);
-			
+		
+		string statisticApplyTo = "";
 		if (UtilGtk.ComboGetActive(combo_stats_stat_subtype) == 
-				Catalog.GetString(Constants.SubtractionBetweenTests))
-			statisticApplyTo = UtilGtk.ComboGetActive(combo_subtraction_between_1) + 
-				":" + UtilGtk.ComboGetActive(combo_subtraction_between_2);
+				Catalog.GetString(Constants.SubtractionBetweenTests)) 
+			statisticApplyTo = UtilGtk.ComboGetActive(combo_subtraction_between_1) + "," +
+				UtilGtk.ComboGetActive(combo_subtraction_between_2);
+		else 
+			statisticApplyTo = UtilGtk.ComboGetActive(combo_stats_stat_apply_to);
+		
+
 
 		if(statsColumnsToRemove && !graph) {
 			statsRemoveColumns();
@@ -1162,19 +1166,12 @@ public class StatsWindow {
 		}
 	}
 	
-	private void on_combo_subtraction_between_1_changed(object o, EventArgs args) {
-		Log.WriteLine(UtilGtk.ComboGetActive(combo_subtraction_between_1));
-		string myText = UtilGtk.ComboGetActive(combo_subtraction_between_1);
-		string myText2 = UtilGtk.ComboGetActive(combo_subtraction_between_2);
-		if (myText != "" && (myText2 != "") ) 
-			fillTreeView_stats(false);
-	}
-	private void on_combo_subtraction_between_2_changed(object o, EventArgs args) {
-		Log.WriteLine(UtilGtk.ComboGetActive(combo_subtraction_between_2));
+	private void on_combo_subtraction_between_1_or_2_changed(object o, EventArgs args) {
 		string myText = UtilGtk.ComboGetActive(combo_subtraction_between_1);
 		string myText2 = UtilGtk.ComboGetActive(combo_subtraction_between_2);
-		if (myText != "" && (myText2 != "") ) 
+		if (myText != "" && myText2 != "") {
 			fillTreeView_stats(false);
+		}
 	}
 	
 	private void on_radiobuttons_stat_session_toggled (object o, EventArgs args)
@@ -1278,10 +1275,16 @@ public class StatsWindow {
 				statisticSubType += "." + ( spinbutton_mark_consecutives.Value ).ToString(); 
 			}
 			
-			string statisticApplyTo = UtilGtk.ComboGetActive(combo_stats_stat_apply_to);
-			if(statisticApplyTo.Length == 0) {
+			string statisticApplyTo = "";
+			if (UtilGtk.ComboGetActive(combo_stats_stat_subtype) == 
+					Catalog.GetString(Constants.SubtractionBetweenTests)) 
+				statisticApplyTo = UtilGtk.ComboGetActive(combo_subtraction_between_1) + "," +
+					UtilGtk.ComboGetActive(combo_subtraction_between_2);
+			else 
+				statisticApplyTo = UtilGtk.ComboGetActive(combo_stats_stat_apply_to);
+		
+			if(statisticApplyTo.Length == 0) 
 				statisticApplyTo = "-";
-			}
 	
 			string statsShowJumps = "";
 			if (radiobutton_stats_jumps_all.Active) {
diff --git a/src/report.cs b/src/report.cs
index c6a3bcf..d8634f3 100644
--- a/src/report.cs
+++ b/src/report.cs
@@ -313,7 +313,7 @@ public class Report : ExportSession
 	{
 		if(StatisticsData.Count > 0)
 			writer.WriteLine("<h2>Statistics</h2>");
-		
+	
 		//obtain every report stats one by one
 		for(int statCount=0; statCount < StatisticsData.Count ; statCount++) {
 			string [] strFull = StatisticsData[statCount].ToString().Split(new char[] {'\t'});
diff --git a/src/sqlite/stat.cs b/src/sqlite/stat.cs
index 2d1bde3..b5d7072 100644
--- a/src/sqlite/stat.cs
+++ b/src/sqlite/stat.cs
@@ -811,10 +811,12 @@ class SqliteStat : Sqlite
 		//*1.0 for having double division
 		if(ini == "MAX(") {
 			//search MAX of two jumps, not max index!!
-			moreSelect = " (MAX(j1.tv) - MAX(j2.tv)) AS myIndex, " +
+			moreSelect = " ( MAX(j1.tv) - MAX(j2.tv) )*100/(MAX(j1.tv)*1.0) AS resultPercent, " +
+				" (MAX(j1.tv) - MAX(j2.tv)) AS result, " +
 				"MAX(j1.tv), MAX(j2.tv) ";
 		} else if(ini == "AVG(") {
-			moreSelect = " (AVG(j1.tv) - AVG(j2.tv)) AS myIndex, " +
+			moreSelect = " ( AVG(j1.tv) - AVG(j2.tv) )*100/(AVG(j1.tv)*1.0) AS resultPercent, " +
+				" (AVG(j1.tv) - AVG(j2.tv)) AS result, " +
 				"AVG(j1.tv), AVG(j2.tv)";
 		}
 
@@ -838,7 +840,7 @@ class SqliteStat : Sqlite
 			" AND j1.personID == " + tp + ".uniqueID " +
 			" AND j2.personID == " + tp + ".uniqueID " +
 			groupByString +
-			orderByString + " myIndex DESC ";
+			orderByString + " resultPercent DESC ";
 
 		Log.WriteLine(dbcmd.CommandText.ToString());
 		dbcmd.ExecuteNonQuery();
@@ -861,12 +863,13 @@ class SqliteStat : Sqlite
 				//in multisession we show only one column x session
 				//in simplesession we show all
 				
-				returnJump1String = ":" + Util.ChangeDecimalSeparator(reader[4].ToString());
-				returnJump2String = ":" + Util.ChangeDecimalSeparator(reader[5].ToString());
+				returnJump1String = ":" + Util.ChangeDecimalSeparator(reader[5].ToString());
+				returnJump2String = ":" + Util.ChangeDecimalSeparator(reader[6].ToString());
 			}
 			myArray.Add (reader[0].ToString() + showSexString +
 					returnSessionString + ":" + 		//session
-					Util.ChangeDecimalSeparator(reader[3].ToString()) +			//index
+					Util.ChangeDecimalSeparator(reader[3].ToString()) + ":" + //resultPercent
+					Util.ChangeDecimalSeparator(reader[4].ToString()) +	//result
 					returnJump1String + 			//jump1
 					returnJump2String  			//jump2
 				    );
diff --git a/src/stats/graphs/ieIub.cs b/src/stats/graphs/ieIub.cs
index 45fd3ac..512ea25 100644
--- a/src/stats/graphs/ieIub.cs
+++ b/src/stats/graphs/ieIub.cs
@@ -89,10 +89,10 @@ public class GraphIeIub : StatIeIub
 			serieJump1.IsLeftAxis = false;
 			serieJump2.IsLeftAxis = false;
 
-			CurrentGraphData.LabelLeft = 
+			CurrentGraphData.LabelLeft = Catalog.GetString("Index") + "(%)";
+			CurrentGraphData.LabelRight =
 				jump1 + " " + Catalog.GetString("TF") + "(s), " + 
 				jump2 + " " + Catalog.GetString("TF") + "(s)";
-			CurrentGraphData.LabelRight = Catalog.GetString("Index") + "(%)";
 		} else {
 			for(int i=0; i < sessions.Count ; i++) {
 				string [] stringFullResults = sessions[i].ToString().Split(new char[] {':'});
diff --git a/src/stats/graphs/jumpSimpleSubtraction.cs b/src/stats/graphs/jumpSimpleSubtraction.cs
index 5fe9796..b295843 100644
--- a/src/stats/graphs/jumpSimpleSubtraction.cs
+++ b/src/stats/graphs/jumpSimpleSubtraction.cs
@@ -32,22 +32,24 @@ public class GraphJumpSimpleSubtraction : StatJumpSimpleSubtraction
 	protected string operation;
 
 	//for simplesession
-	GraphSerie serieIndex;
+	GraphSerie serieResultPercent;
+	//GraphSerie serieResult; //don't plot the result, plot the resultPercent
 	GraphSerie serieJump1;
 	GraphSerie serieJump2;
 
 	public GraphJumpSimpleSubtraction  (StatTypeStruct myStatTypeStruct)
 	{
+Log.WriteLine("C");
 		completeConstruction (myStatTypeStruct, treeview);
 		
-		this.dataColumns = 3; //for Simplesession (index, test1, test2)
+		this.dataColumns = 4; //for Simplesession (resultPercent, result, test1, test2)
 		
-		string [] applyTos = myStatTypeStruct.StatisticApplyTo.Split(new char[] {':'});
+		string [] applyTos = myStatTypeStruct.StatisticApplyTo.Split(new char[] {','});
 		test1 = applyTos[0];
 		test2 = applyTos[1];
 		
 		columnsString[0] = "Jumper";
-		columnsString[1] = Catalog.GetString("Result");
+		columnsString[1] = Catalog.GetString("ResultPercent");
 		columnsString[2] = test1;
 		columnsString[3] = test2;
 		
@@ -67,30 +69,31 @@ public class GraphJumpSimpleSubtraction : StatJumpSimpleSubtraction
 		
 		if(sessions.Count == 1) {
 			//four series, the four columns
-			serieIndex = new GraphSerie();
+			serieResultPercent = new GraphSerie();
 			serieJump1 = new GraphSerie();
 			serieJump2 = new GraphSerie();
 				
-			serieIndex.Title = Catalog.GetString("Result");
+			serieResultPercent.Title = Catalog.GetString("ResultPercent");
 			serieJump1.Title = test1;
 			serieJump2.Title = test2;
 		
-			serieIndex.IsLeftAxis = true;
+			serieResultPercent.IsLeftAxis = true;
 			serieJump1.IsLeftAxis = false;
 			serieJump2.IsLeftAxis = false;
 
-			CurrentGraphData.LabelLeft = 
+			CurrentGraphData.LabelLeft = Catalog.GetString("Result") + "(%)"; 
+			CurrentGraphData.LabelRight = 
 				test1 + " " + Catalog.GetString("TF") + "(s), " + 
 				test2 + " " + Catalog.GetString("TF") + "(s)";
-			CurrentGraphData.LabelRight = Catalog.GetString("TF") + "(s)";
 		} else {
 			for(int i=0; i < sessions.Count ; i++) {
 				string [] stringFullResults = sessions[i].ToString().Split(new char[] {':'});
 				CurrentGraphData.XAxisNames.Add(stringFullResults[1].ToString());
 			}
-			CurrentGraphData.LabelLeft = Catalog.GetString("TF") + "(s)";
+			CurrentGraphData.LabelLeft = Catalog.GetString("Result") + "(%)";
 			CurrentGraphData.LabelRight = "";
 		}
+Log.WriteLine("C");
 	}
 
 	protected override void printData (string [] statValues) 
@@ -111,15 +114,16 @@ public class GraphJumpSimpleSubtraction : StatJumpSimpleSubtraction
 						CurrentGraphData.XAxisNames.Add(myValue);
 				} else if(i == 1) {
 					if(foundAVG)
-						serieIndex.Avg = Convert.ToDouble(myValue);
+						serieResultPercent.Avg = Convert.ToDouble(myValue);
 					else
-						serieIndex.SerieData.Add(myValue);
-				} else if(i == 2) {
+						serieResultPercent.SerieData.Add(myValue);
+				//2 is result and is not plotted
+				} else if(i == 3) {
 					if(foundAVG)
 						serieJump1.Avg = Convert.ToDouble(myValue);
 					else
 						serieJump1.SerieData.Add(myValue);
-				} else if(i == 3) {
+				} else if(i == 4) {
 					if(foundAVG)
 						serieJump2.Avg = Convert.ToDouble(myValue);
 					else
@@ -132,7 +136,7 @@ public class GraphJumpSimpleSubtraction : StatJumpSimpleSubtraction
 					if(GraphSeries.Count == 0) {
 							GraphSeries.Add(serieJump1);
 							GraphSeries.Add(serieJump2);
-							GraphSeries.Add(serieIndex);
+							GraphSeries.Add(serieResultPercent);
 					}
 					return;
 				}
diff --git a/src/stats/jumpSimpleSubtraction.cs b/src/stats/jumpSimpleSubtraction.cs
index 81de26f..e26e9c0 100644
--- a/src/stats/jumpSimpleSubtraction.cs
+++ b/src/stats/jumpSimpleSubtraction.cs
@@ -29,7 +29,7 @@ public class StatJumpSimpleSubtraction : Stat
 {
 	protected string test1;
 	protected string test2;
-	protected string [] columnsString = new String[4];
+	protected string [] columnsString = new String[5];
 	
 	//if this is not present i have problems like (No overload for method `xxx' takes `0' arguments) with some inherited classes
 	public StatJumpSimpleSubtraction () 
@@ -43,22 +43,24 @@ public class StatJumpSimpleSubtraction : Stat
 	{
 		completeConstruction (myStatTypeStruct, treeview);
 		
-		this.dataColumns = 3;	//for simplesession (result, test1, test2)
+		this.dataColumns = 4;	//for simplesession (result %, result, test1, test2)
 
-		string [] applyTos = myStatTypeStruct.StatisticApplyTo.Split(new char[] {':'});
+
+		string [] applyTos = myStatTypeStruct.StatisticApplyTo.Split(new char[] {','});
 		test1 = applyTos[0];
 		test2 = applyTos[1];
 		
 		if(sessions.Count > 1) {
 			store = getStore(sessions.Count +3); //+3 (for jumper, the AVG horizontal and SD horizontal)
 		} else {
-			store = getStore(dataColumns +1); //jumper, result, test1, test2
+			store = getStore(dataColumns +1); //jumper, result %, result, test1, test2
 		}
 		
 		columnsString[0] = Catalog.GetString("Jumper");
-		columnsString[1] = Catalog.GetString("Result");
-		columnsString[2] = test1;
-		columnsString[3] = test2;
+		columnsString[1] = Catalog.GetString("Result %");
+		columnsString[2] = Catalog.GetString("Result");
+		columnsString[3] = test1;
+		columnsString[4] = test2;
 		
 		if(toReport) {
 			reportString = prepareHeadersReport(columnsString);



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