chronojump r479 - in trunk: . build/data glade src src/execute src/gui src/sqlite



Author: xaviblas
Date: Tue Mar 31 08:56:51 2009
New Revision: 479
URL: http://svn.gnome.org/viewvc/chronojump?rev=479&view=rev

Log:
in execution graph put avgs as horizontal lines
and plot all tests of same type of same person
done for jump

Fixed? bug on thread sqlite at start (see 2 pngs at Desktop)
Margaria description unsensitive at edit
margaria power (at description) changes when person weight change


Modified:
   trunk/TODO.txt
   trunk/build/data/chronojump.prg
   trunk/build/data/chronojump_mini.prg
   trunk/changelog.txt
   trunk/glade/chronojump.glade
   trunk/src/execute/run.cs
   trunk/src/exportSession.cs
   trunk/src/gui/chronojump.cs
   trunk/src/gui/eventExecute.cs
   trunk/src/gui/person.cs
   trunk/src/gui/run.cs
   trunk/src/report.cs
   trunk/src/runType.cs
   trunk/src/server.cs
   trunk/src/sqlite/jump.cs
   trunk/src/sqlite/run.cs
   trunk/src/sqlite/runInterval.cs
   trunk/src/sqlite/session.cs

Modified: trunk/TODO.txt
==============================================================================
--- trunk/TODO.txt	(original)
+++ trunk/TODO.txt	Tue Mar 31 08:56:51 2009
@@ -27,22 +27,16 @@
 (low and hight case)
 i think there will be no problems because all is parametrized
 
-Fix bug on thread sqlite at start (see 2 pngs at Desktop)
-
 Put pictures and description of runAnalysis. Do svn add, Makefile, ...
 
+Add longDescription on margaria
+
 
 intersession stats only have to show one max or avg, not n max or all jumps
 stats all and limit is not updating the treeview stats. 
 
 us Util.DetectPortsLinux in gui/help ports
 
-when person weight is updated, description of eg. margaria (with power)
-doesn't change. Should change or use another thing. Recreate all time in
-session.... also same when edit jump.
-Maybe is better to don't have it (the power) recorded at any place but generate when it's
-required
-
 create a server mini program that tries to do a ping and if it fails, 
 then write something in a file, and another program restarts server
 fo it as to chrons. Record some stat data in another file
@@ -50,6 +44,9 @@
 
 in execution graph put avgs as horizontal lines
 and plot all tests of same type of same person
+jump done, need run and reactionTime (maybe also pulse)
+
+eventExecure reactionTimeGraph doesn't plot now because uses paintJumpSimple that has changed
 
 count time(s)  cp change diff same cp diff all cp
 1          10   1     IN           10          10
@@ -93,8 +90,8 @@
        ----     -
 
 
+merge databases
 
-edit jump need the hability of change the DJ fall and the SJ+ weight
 
 - Capacitat de salt Total: (SJ+100%) + (sj-sj+100%) + (cmj-sj) + (abk-cmj) + (dj-abk)
 (altura DJ ?). Aixo funciona, pero no agafa la linia si falta algun salt:

Modified: trunk/build/data/chronojump.prg
==============================================================================
Binary files. No diff available.

Modified: trunk/build/data/chronojump_mini.prg
==============================================================================
Binary files. No diff available.

Modified: trunk/changelog.txt
==============================================================================
--- trunk/changelog.txt	(original)
+++ trunk/changelog.txt	Tue Mar 31 08:56:51 2009
@@ -1,5 +1,14 @@
 CHANGELOG.txt
 
+31 mar 2009
+	in execution graph put avgs as horizontal lines
+	and plot all tests of same type of same person
+	done for jump
+
+	Fixed? bug on thread sqlite at start (see 2 pngs at Desktop)
+	Margaria description unsensitive at edit
+	margaria power (at description) changes when person weight change
+
 30 mar 2009
 	multiChronopic:
 	-event window is connected and start showing graph data (incorrect now)

Modified: trunk/glade/chronojump.glade
==============================================================================
--- trunk/glade/chronojump.glade	(original)
+++ trunk/glade/chronojump.glade	Tue Mar 31 08:56:51 2009
@@ -15715,22 +15715,6 @@
 		      <property name="column_spacing">0</property>
 
 		      <child>
-			<widget class="GtkDrawingArea" id="drawingarea">
-			  <property name="width_request">100</property>
-			  <property name="height_request">200</property>
-			  <property name="visible">True</property>
-			  <signal name="configure_event" handler="on_drawingarea_configure_event" last_modification_time="Sun, 24 Sep 2006 22:41:23 GMT"/>
-			  <signal name="expose_event" handler="on_drawingarea_expose_event" last_modification_time="Sun, 24 Sep 2006 22:41:38 GMT"/>
-			</widget>
-			<packing>
-			  <property name="left_attach">1</property>
-			  <property name="right_attach">2</property>
-			  <property name="top_attach">0</property>
-			  <property name="bottom_attach">1</property>
-			</packing>
-		      </child>
-
-		      <child>
 			<widget class="GtkTable" id="table_jump_reactive_values">
 			  <property name="visible">True</property>
 			  <property name="n_rows">4</property>
@@ -18076,13 +18060,13 @@
 		      </child>
 
 		      <child>
-			<widget class="GtkHBox" id="hbox_jump_simple_titles">
+			<widget class="GtkHBox" id="hbox_run_simple_titles">
 			  <property name="visible">True</property>
 			  <property name="homogeneous">True</property>
 			  <property name="spacing">0</property>
 
 			  <child>
-			    <widget class="GtkLabel" id="label252">
+			    <widget class="GtkLabel" id="label279">
 			      <property name="visible">True</property>
 			      <property name="label" translatable="yes">Now</property>
 			      <property name="use_underline">False</property>
@@ -18107,7 +18091,7 @@
 			  </child>
 
 			  <child>
-			    <widget class="GtkLabel" id="label253">
+			    <widget class="GtkLabel" id="label280">
 			      <property name="visible">True</property>
 			      <property name="label" translatable="yes">Person AVG</property>
 			      <property name="use_underline">False</property>
@@ -18132,7 +18116,7 @@
 			  </child>
 
 			  <child>
-			    <widget class="GtkLabel" id="label254">
+			    <widget class="GtkLabel" id="label281">
 			      <property name="visible">True</property>
 			      <property name="label" translatable="yes">Session AVG</property>
 			      <property name="use_underline">False</property>
@@ -18159,19 +18143,19 @@
 			<packing>
 			  <property name="left_attach">1</property>
 			  <property name="right_attach">2</property>
-			  <property name="top_attach">1</property>
-			  <property name="bottom_attach">2</property>
+			  <property name="top_attach">4</property>
+			  <property name="bottom_attach">5</property>
 			</packing>
 		      </child>
 
 		      <child>
-			<widget class="GtkHBox" id="hbox_run_simple_titles">
+			<widget class="GtkHBox" id="hbox_reaction_time_titles">
 			  <property name="visible">True</property>
 			  <property name="homogeneous">True</property>
 			  <property name="spacing">0</property>
 
 			  <child>
-			    <widget class="GtkLabel" id="label279">
+			    <widget class="GtkLabel" id="label451">
 			      <property name="visible">True</property>
 			      <property name="label" translatable="yes">Now</property>
 			      <property name="use_underline">False</property>
@@ -18196,7 +18180,7 @@
 			  </child>
 
 			  <child>
-			    <widget class="GtkLabel" id="label280">
+			    <widget class="GtkLabel" id="label452">
 			      <property name="visible">True</property>
 			      <property name="label" translatable="yes">Person AVG</property>
 			      <property name="use_underline">False</property>
@@ -18221,7 +18205,7 @@
 			  </child>
 
 			  <child>
-			    <widget class="GtkLabel" id="label281">
+			    <widget class="GtkLabel" id="label453">
 			      <property name="visible">True</property>
 			      <property name="label" translatable="yes">Session AVG</property>
 			      <property name="use_underline">False</property>
@@ -18248,19 +18232,36 @@
 			<packing>
 			  <property name="left_attach">1</property>
 			  <property name="right_attach">2</property>
-			  <property name="top_attach">4</property>
-			  <property name="bottom_attach">5</property>
+			  <property name="top_attach">8</property>
+			  <property name="bottom_attach">9</property>
+			  <property name="x_options">fill</property>
 			</packing>
 		      </child>
 
 		      <child>
-			<widget class="GtkHBox" id="hbox_reaction_time_titles">
+			<widget class="GtkDrawingArea" id="drawingarea">
+			  <property name="width_request">100</property>
+			  <property name="height_request">200</property>
+			  <property name="visible">True</property>
+			  <signal name="configure_event" handler="on_drawingarea_configure_event" last_modification_time="Sun, 24 Sep 2006 22:41:23 GMT"/>
+			  <signal name="expose_event" handler="on_drawingarea_expose_event" last_modification_time="Sun, 24 Sep 2006 22:41:38 GMT"/>
+			</widget>
+			<packing>
+			  <property name="left_attach">1</property>
+			  <property name="right_attach">2</property>
+			  <property name="top_attach">0</property>
+			  <property name="bottom_attach">1</property>
+			</packing>
+		      </child>
+
+		      <child>
+			<widget class="GtkHBox" id="hbox_jump_simple_titles">
 			  <property name="visible">True</property>
 			  <property name="homogeneous">True</property>
 			  <property name="spacing">0</property>
 
 			  <child>
-			    <widget class="GtkLabel" id="label451">
+			    <widget class="GtkLabel" id="label252">
 			      <property name="visible">True</property>
 			      <property name="label" translatable="yes">Now</property>
 			      <property name="use_underline">False</property>
@@ -18285,7 +18286,7 @@
 			  </child>
 
 			  <child>
-			    <widget class="GtkLabel" id="label452">
+			    <widget class="GtkLabel" id="label253">
 			      <property name="visible">True</property>
 			      <property name="label" translatable="yes">Person AVG</property>
 			      <property name="use_underline">False</property>
@@ -18310,7 +18311,7 @@
 			  </child>
 
 			  <child>
-			    <widget class="GtkLabel" id="label453">
+			    <widget class="GtkLabel" id="label254">
 			      <property name="visible">True</property>
 			      <property name="label" translatable="yes">Session AVG</property>
 			      <property name="use_underline">False</property>
@@ -18337,9 +18338,9 @@
 			<packing>
 			  <property name="left_attach">1</property>
 			  <property name="right_attach">2</property>
-			  <property name="top_attach">8</property>
-			  <property name="bottom_attach">9</property>
-			  <property name="x_options">fill</property>
+			  <property name="top_attach">1</property>
+			  <property name="bottom_attach">2</property>
+			  <property name="y_padding">8</property>
 			</packing>
 		      </child>
 		    </widget>

Modified: trunk/src/execute/run.cs
==============================================================================
--- trunk/src/execute/run.cs	(original)
+++ trunk/src/execute/run.cs	Tue Mar 31 08:56:51 2009
@@ -297,8 +297,8 @@
 			// W: person weight
 			// D: distance between 3d and 9th stair
 			double weight = SqlitePersonSession.SelectPersonWeight(personID, sessionID);
-			double distanceMM = distance / 1000;
-			description = "P = " + Util.TrimDecimals ( (weight * 9.8 * distanceMM / time).ToString(), pDN) + " (Watts)";
+			double distanceMeters = distance / 1000;
+			description = "P = " + Util.TrimDecimals ( (weight * 9.8 * distanceMeters / time).ToString(), pDN) + " (Watts)";
 		}
 
 		uniqueID = SqliteRun.Insert(false, Constants.RunTable, "NULL", personID, sessionID, 

Modified: trunk/src/exportSession.cs
==============================================================================
--- trunk/src/exportSession.cs	(original)
+++ trunk/src/exportSession.cs	Tue Mar 31 08:56:51 2009
@@ -163,10 +163,10 @@
 	protected virtual void getData() 
 	{
 		myPersons = SqlitePersonSession.SelectCurrentSession(mySession.UniqueID, false, false); //not onlyIDAndName, not reversed
-		myJumps= SqliteJump.SelectJumps(mySession.UniqueID, -1, "");
+		myJumps= SqliteJump.SelectJumps(mySession.UniqueID, -1, "", "");
 		myJumpsRj = SqliteJumpRj.SelectJumps(mySession.UniqueID, -1, "");
-		myRuns= SqliteRun.SelectAllRuns(mySession.UniqueID, -1);
-		myRunsInterval = SqliteRunInterval.SelectAllRuns(mySession.UniqueID, -1);
+		myRuns= SqliteRun.SelectRuns(mySession.UniqueID, -1, "");
+		myRunsInterval = SqliteRunInterval.SelectRuns(mySession.UniqueID, -1);
 		myReactionTimes = SqliteReactionTime.SelectAllReactionTimes(mySession.UniqueID, -1);
 		myPulses = SqlitePulse.SelectAllPulses(mySession.UniqueID, -1);
 	}

Modified: trunk/src/gui/chronojump.cs
==============================================================================
--- trunk/src/gui/chronojump.cs	(original)
+++ trunk/src/gui/chronojump.cs	Tue Mar 31 08:56:51 2009
@@ -1167,7 +1167,7 @@
 	private void fillTreeView_jumps (string filter) {
 		string [] myJumps;
 	
-		myJumps = SqliteJump.SelectJumps(currentSession.UniqueID, -1, "");
+		myJumps = SqliteJump.SelectJumps(currentSession.UniqueID, -1, "", "");
 		myTreeViewJumps.Fill(myJumps, filter);
 
 		expandOrMinimizeTreeView((TreeViewEvent) myTreeViewJumps, treeview_jumps);
@@ -1306,7 +1306,7 @@
 	}
 
 	private void fillTreeView_runs (string filter) {
-		string [] myRuns = SqliteRun.SelectAllRuns(currentSession.UniqueID, -1);
+		string [] myRuns = SqliteRun.SelectRuns(currentSession.UniqueID, -1, "");
 		myTreeViewRuns.Fill(myRuns, filter);
 
 		expandOrMinimizeTreeView((TreeViewEvent) myTreeViewRuns, treeview_runs);
@@ -1370,7 +1370,7 @@
 	}
 
 	private void fillTreeView_runs_interval (string filter) {
-		string [] myRuns = SqliteRunInterval.SelectAllRuns(currentSession.UniqueID, -1);
+		string [] myRuns = SqliteRunInterval.SelectRuns(currentSession.UniqueID, -1);
 		myTreeViewRunsInterval.Fill(myRuns, filter);
 		expandOrMinimizeTreeView((TreeViewEvent) myTreeViewRunsInterval, treeview_runs_interval);
 	}
@@ -2077,7 +2077,7 @@
 	}
 		
 	private void on_person_add_single_activate (object o, EventArgs args) {
-		personAddModifyWin = PersonAddModifyWindow.Show(app1, currentSession, -1); 
+		personAddModifyWin = PersonAddModifyWindow.Show(app1, currentSession, -1, prefsDigitsNumber); 
 		//-1 means we are adding a new person
 		//if we were modifying it will be it's uniqueID
 		
@@ -2135,7 +2135,7 @@
 	
 	private void on_edit_current_person_clicked (object o, EventArgs args) {
 		Log.WriteLine("modify person");
-		personAddModifyWin = PersonAddModifyWindow.Show(app1, currentSession, currentPerson.UniqueID);
+		personAddModifyWin = PersonAddModifyWindow.Show(app1, currentSession, currentPerson.UniqueID, prefsDigitsNumber);
 		personAddModifyWin.FakeButtonAccept.Clicked += new EventHandler(on_edit_current_person_accepted);
 	}
 	

Modified: trunk/src/gui/eventExecute.cs
==============================================================================
--- trunk/src/gui/eventExecute.cs	(original)
+++ trunk/src/gui/eventExecute.cs	Tue Mar 31 08:56:51 2009
@@ -522,14 +522,16 @@
 
 		
 		//obtain data
-		double tvPersonAVG = SqliteSession.SelectAllEventsOfAType(sessionID, personID, tableName, eventType, "TV");
-		double tvSessionAVG = SqliteSession.SelectAllEventsOfAType(sessionID, -1, tableName, eventType, "TV");
+		string []jumps = SqliteJump.SelectJumps(sessionID, personID, "", eventType);
+
+		double tvPersonAVG = SqliteSession.SelectAVGEventsOfAType(sessionID, personID, tableName, eventType, "TV");
+		double tvSessionAVG = SqliteSession.SelectAVGEventsOfAType(sessionID, -1, tableName, eventType, "TV");
 
 		double tcPersonAVG = 0; 
 		double tcSessionAVG = 0; 
 		if(tc > 0) {
-			tcPersonAVG = SqliteSession.SelectAllEventsOfAType(sessionID, personID, tableName, eventType, "TC");
-			tcSessionAVG = SqliteSession.SelectAllEventsOfAType(sessionID, -1, tableName, eventType, "TC");
+			tcPersonAVG = SqliteSession.SelectAVGEventsOfAType(sessionID, personID, tableName, eventType, "TC");
+			tcSessionAVG = SqliteSession.SelectAVGEventsOfAType(sessionID, -1, tableName, eventType, "TC");
 		}
 		
 		double maxValue = 0;
@@ -542,6 +544,13 @@
 			maxValue = Util.GetMax(
 					tv.ToString() + "=" + tvPersonAVG.ToString() + "=" + tvSessionAVG.ToString() + "=" +
 					tc.ToString() + "=" + tcPersonAVG.ToString() + "=" + tcSessionAVG.ToString());
+			foreach(string myStr in jumps) {
+				string [] jump = myStr.Split(new char[] {':'});
+				if(Convert.ToDouble(jump[5]) > maxValue)
+					maxValue = Convert.ToDouble(jump[5]); //tf
+				if(Convert.ToDouble(jump[6]) > maxValue)
+					maxValue = Convert.ToDouble(jump[6]); //tc
+			}
 		} else {
 			maxValue = eventGraphConfigureWin.Max;
 			topMargin = 0;
@@ -553,13 +562,20 @@
 			if(tc > 0)
 				myString = myString + "=" + tc.ToString() + "=" + tcPersonAVG.ToString() + "=" + tcSessionAVG.ToString();
 			minValue = Util.GetMin(myString);
+			foreach(string myStr in jumps) {
+				string [] jump = myStr.Split(new char[] {':'});
+				if(Convert.ToDouble(jump[5]) < minValue)
+					minValue = Convert.ToDouble(jump[5]); //tf
+				if(Convert.ToDouble(jump[6]) < minValue)
+					minValue = Convert.ToDouble(jump[6]); //tc
+			}
 		} else {
 			minValue = eventGraphConfigureWin.Min;
 			bottomMargin = 0;
 		}
 		
 		//paint graph
-		paintJumpSimple (drawingarea, tv, tvPersonAVG, tvSessionAVG, tc, tcPersonAVG, tcSessionAVG, maxValue, minValue, topMargin, bottomMargin);
+		paintJumpSimple (drawingarea, jumps, tv, tvPersonAVG, tvSessionAVG, tc, tcPersonAVG, tcSessionAVG, maxValue, minValue, topMargin, bottomMargin);
 
 		//printLabels
 		printLabelsJumpSimple (tv, tvPersonAVG, tvSessionAVG, tc, tcPersonAVG, tcSessionAVG);
@@ -661,18 +677,18 @@
 			paintTime = true;
 		
 		//obtain data
-		double timePersonAVG = SqliteSession.SelectAllEventsOfAType(sessionID, personID, tableName, eventType, "time");
-		double timeSessionAVG = SqliteSession.SelectAllEventsOfAType(sessionID, -1, tableName, eventType, "time");
+		double timePersonAVG = SqliteSession.SelectAVGEventsOfAType(sessionID, personID, tableName, eventType, "time");
+		double timeSessionAVG = SqliteSession.SelectAVGEventsOfAType(sessionID, -1, tableName, eventType, "time");
 
-		//double distancePersonAVG = SqliteSession.SelectAllEventsOfAType(sessionID, personID, tableName, eventType, "distance");
-		//double distanceSessionAVG = SqliteSession.SelectAllEventsOfAType(sessionID, -1, tableName, eventType, "distance");
+		//double distancePersonAVG = SqliteSession.SelectAVGEventsOfAType(sessionID, personID, tableName, eventType, "distance");
+		//double distanceSessionAVG = SqliteSession.SelectAVGEventsOfAType(sessionID, -1, tableName, eventType, "distance");
 		//better to know speed like:
 		//SELECT AVG(distance/time) from run; than 
 		//SELECT AVG(distance) / SELECT AVG(time) 
 		//first is ok, because is the speed AVG
 		//2nd is not good because it tries to do an AVG of all distances and times
-		double speedPersonAVG = SqliteSession.SelectAllEventsOfAType(sessionID, personID, tableName, eventType, "distance/time");
-		double speedSessionAVG = SqliteSession.SelectAllEventsOfAType(sessionID, -1, tableName, eventType, "distance/time");
+		double speedPersonAVG = SqliteSession.SelectAVGEventsOfAType(sessionID, personID, tableName, eventType, "distance/time");
+		double speedSessionAVG = SqliteSession.SelectAVGEventsOfAType(sessionID, -1, tableName, eventType, "distance/time");
 
 		double maxValue = 0;
 		double minValue = 0;
@@ -825,8 +841,8 @@
 
 		
 		//obtain data
-		double timePersonAVG = SqliteSession.SelectAllEventsOfAType(sessionID, personID, tableName, eventType, "time");
-		double timeSessionAVG = SqliteSession.SelectAllEventsOfAType(sessionID, -1, tableName, eventType, "time");
+		double timePersonAVG = SqliteSession.SelectAVGEventsOfAType(sessionID, personID, tableName, eventType, "time");
+		double timeSessionAVG = SqliteSession.SelectAVGEventsOfAType(sessionID, -1, tableName, eventType, "time");
 
 		double maxValue = 0;
 		double minValue = 0;
@@ -852,7 +868,8 @@
 		}
 		
 		//paint graph (use simple jump method)
-		paintJumpSimple (drawingarea, time, timePersonAVG, timeSessionAVG, 0, 0, 0, maxValue, minValue, topMargin, bottomMargin);
+		//TODO: fix this, paintJumpSimple changed
+		//paintJumpSimple (drawingarea, time, timePersonAVG, timeSessionAVG, 0, 0, 0, maxValue, minValue, topMargin, bottomMargin);
 
 		printLabelsReactionTime (time, timePersonAVG, timeSessionAVG);
 		
@@ -947,7 +964,7 @@
 	}
 	
 
-	private void paintJumpSimple (Gtk.DrawingArea drawingarea, 
+	private void paintJumpSimple (Gtk.DrawingArea drawingarea, string [] jumps, 
 			double tvNow, double tvPerson, double tvSession, 
 			double tcNow, double tcPerson, double tcSession,
 			double maxValue, double minValue, int topMargin, int bottomMargin)
@@ -965,19 +982,48 @@
 		if(maxValue - minValue > 0) {
 			//red for TC
 			if(tcNow > 0) {
-				pixmap.DrawLine(pen_rojo, ancho*1/6, alto, ancho*1/6, calculatePaintHeight(tcNow, alto, maxValue, minValue, topMargin, bottomMargin));
-				pixmap.DrawLine(pen_rojo, ancho*3/6, alto, ancho*3/6, calculatePaintHeight(tcPerson, alto, maxValue, minValue, topMargin, bottomMargin));
-				pixmap.DrawLine(pen_rojo, ancho*5/6, alto, ancho*5/6, calculatePaintHeight(tcSession, alto, maxValue, minValue, topMargin, bottomMargin));
+				int count = 0;
+				foreach(string myStr in jumps) {
+					string [] jump = myStr.Split(new char[] {':'});
+					pixmap.DrawLine(pen_rojo, 
+							Convert.ToInt32((ancho-rightMargin)*(count+.5)/jumps.Length), alto, 
+							Convert.ToInt32((ancho-rightMargin)*(count+.5)/jumps.Length), 
+							calculatePaintHeight(Convert.ToDouble(jump[6]), alto, maxValue, minValue, topMargin, bottomMargin));
+					count ++;
+				}
+				
+				//red tc average line	
+				drawGuideOrAVG(pen_rojo, 	tcPerson, alto, ancho, topMargin, bottomMargin, maxValue, minValue);
+				drawGuideOrAVG(pen_rojo_discont, tcSession, alto, ancho, topMargin, bottomMargin, maxValue, minValue);
 			}
 		
 			//blue for TF
 			//check it's not a take off
 			if(tvNow > 0) {
-				pixmap.DrawLine(pen_azul, ancho*1/6 +10, alto, ancho*1/6 +10, calculatePaintHeight(tvNow, alto, maxValue, minValue, topMargin, bottomMargin));
-				pixmap.DrawLine(pen_azul, ancho*3/6 +10, alto, ancho*3/6 +10, calculatePaintHeight(tvPerson, alto, maxValue, minValue, topMargin, bottomMargin));
-				pixmap.DrawLine(pen_azul, ancho*5/6 +10, alto, ancho*5/6 +10, calculatePaintHeight(tvSession, alto, maxValue, minValue, topMargin, bottomMargin));
+				int tctfSep; //separation between tc and tf
+				if(tcNow == 0)
+					tctfSep = 0;
+				else {
+					int distanceBetweenCols = Convert.ToInt32((ancho-rightMargin)*(1+.5)/jumps.Length) -
+						Convert.ToInt32((ancho-rightMargin)*(0+.5)/jumps.Length);
+					tctfSep = Convert.ToInt32(.3*distanceBetweenCols);
+				}
+				int count = 0;
+				foreach(string myStr in jumps) {
+					string [] jump = myStr.Split(new char[] {':'});
+					pixmap.DrawLine(pen_azul, 
+							Convert.ToInt32((ancho-rightMargin)*(count+.5)/jumps.Length) + tctfSep, alto, 
+							Convert.ToInt32((ancho-rightMargin)*(count+.5)/jumps.Length) + tctfSep, 
+							calculatePaintHeight(Convert.ToDouble(jump[5]), alto, maxValue, minValue, topMargin, bottomMargin));
+					count ++;
+				}
+				
+				//blue tf average discountinuos line	
+				drawGuideOrAVG(pen_azul, 	tvPerson, alto, ancho, topMargin, bottomMargin, maxValue, minValue);
+				drawGuideOrAVG(pen_azul_discont, tvSession, alto, ancho, topMargin, bottomMargin, maxValue, minValue);
 			}
 			
+			/*
 			//circles
 			if(eventGraphConfigureWin.PaintCircle) {
 				if(tcNow > 0) {
@@ -991,7 +1037,8 @@
 					pixmap.DrawArc(pen_azul, true, ancho*3/6 +10 - radio/2 + arcSystemCorrection, calculatePaintHeight(tvPerson, alto, maxValue, minValue, topMargin, bottomMargin) -radio/2, radio , radio, 0, 360*64);
 					pixmap.DrawArc(pen_azul, true, ancho*5/6 +10 - radio/2 + arcSystemCorrection, calculatePaintHeight(tvSession, alto, maxValue, minValue, topMargin, bottomMargin) -radio/2, radio , radio, 0, 360*64);
 				}
-			}	
+			}
+		*/	
 			
 	
 			//paint reference guide black and green if needed
@@ -999,8 +1046,6 @@
 			drawGuideOrAVG(pen_green_discont, eventGraphConfigureWin.GreenGuide, alto, ancho, topMargin, bottomMargin, maxValue, minValue);
 		}
 		
-	
-		
 		graphProgress = phasesGraph.DONE; 
 	}
 
@@ -1600,15 +1645,15 @@
 
 	//projecte cubevirtual de juan gonzalez
 	
-	Gdk.GC pen_rojo; //tc, also time
-	Gdk.GC pen_azul; //tf, also speed and pulse
-	Gdk.GC pen_rojo_discont; //avg tc in reactive
-	Gdk.GC pen_azul_discont; //avg tf in reactive
+	Gdk.GC pen_rojo; //tc, also time; jump avg personTc
+	Gdk.GC pen_azul; //tf, also speed and pulse; jump avg personTv
+	Gdk.GC pen_rojo_discont; //avg tc in reactive; jump avg sessionTc 
+	Gdk.GC pen_azul_discont; //avg tf in reactive; jump avg sessionTv
 	Gdk.GC pen_negro_discont; //guide
 	Gdk.GC pen_green_discont; //guide
 	Gdk.GC pen_gris; //textual data
 	Gdk.GC pen_beige_discont; //Y cols
-	Gdk.GC pen_brown_bold; //best tv/tc in rj
+	Gdk.GC pen_brown_bold; //best tv/tc in rj;
 	Gdk.GC pen_violet_bold; //worst tv/tc in rj
 	//Gdk.GC pen_blanco;
 	

Modified: trunk/src/gui/person.cs
==============================================================================
--- trunk/src/gui/person.cs	(original)
+++ trunk/src/gui/person.cs	Tue Mar 31 08:56:51 2009
@@ -655,6 +655,7 @@
 	private int personID;
 	private string sex = "M";
 	private int weightIni;
+	int pDN;
 	
 	private int serverUniqueID;
 	
@@ -725,11 +726,14 @@
 		sex = "F";
 	}
 	
-	static public PersonAddModifyWindow Show (Gtk.Window parent, Session mySession, int personID)
+	static public PersonAddModifyWindow Show (Gtk.Window parent, Session mySession, int personID, int pDN)
 	{
 		if (PersonAddModifyWindowBox == null) {
 			PersonAddModifyWindowBox = new PersonAddModifyWindow (parent, mySession, personID);
 		}
+
+		PersonAddModifyWindowBox.pDN = pDN;
+		
 		PersonAddModifyWindowBox.person_win.Show ();
 		
 		PersonAddModifyWindowBox.fillDialog ();
@@ -1142,7 +1146,7 @@
 			//if weight has changed
 			if(!adding && (int) spinbutton_weight.Value != weightIni) {
 				//see if this person has done jumps with weight
-				string [] myJumpsNormal = SqliteJump.SelectJumps(currentSession.UniqueID, personID, "withWeight");
+				string [] myJumpsNormal = SqliteJump.SelectJumps(currentSession.UniqueID, personID, "withWeight", "");
 				string [] myJumpsReactive = SqliteJumpRj.SelectJumps(currentSession.UniqueID, personID, "withWeight");
 
 				if(myJumpsNormal.Length > 0 || myJumpsReactive.Length > 0) {
@@ -1177,10 +1181,23 @@
 		//separate by '/' for not confusing with the ':' separation between the other values
 		string dateFull = dateTime.Day.ToString() + "/" + dateTime.Month.ToString() + "/" +
 			dateTime.Year.ToString();
+		
+		double weight = (int) spinbutton_weight.Value;
+
+		//convert margarias (it's power is calculated using weight and it's written on description)
+		string [] myMargarias = SqliteRun.SelectRuns(currentSession.UniqueID, personID, "Margaria");
+		foreach(string myStr in myMargarias) {
+			string [] margaria = myStr.Split(new char[] {':'});
+			Run mRun = SqliteRun.SelectRunData(Convert.ToInt32(margaria[1]));
+			double distanceMeters = mRun.Distance / 1000;
+			mRun.Description = "P = " + Util.TrimDecimals ( (weight * 9.8 * distanceMeters / mRun.Time).ToString(), pDN) + " (Watts)";
+			SqliteRun.Update(mRun.UniqueID, mRun.Type, mRun.Distance.ToString(), mRun.Time.ToString(), mRun.PersonID, mRun.Description);
+		}
+
 
 		if(adding) {
 			currentPerson = new Person (entry1.Text, sex, dateFull, 
-					(int) spinbutton_height.Value, (int) spinbutton_weight.Value, 
+					(int) spinbutton_height.Value, (int) weight, 
 					sport.UniqueID, 
 					Convert.ToInt32(Util.FindOnArray(':', 2, 0, UtilGtk.ComboGetActive(combo_speciallities), speciallities)),
 					Util.FetchID(UtilGtk.ComboGetActive(combo_levels)),
@@ -1191,7 +1208,7 @@
 					currentSession.UniqueID);
 		} else {
 			currentPerson = new Person (personID, entry1.Text, sex, dateFull, 
-					(int) spinbutton_height.Value, (int) spinbutton_weight.Value, 
+					(int) spinbutton_height.Value, (int) weight, 
 					sport.UniqueID, 
 					Convert.ToInt32(Util.FindOnArray(':', 2, 0, UtilGtk.ComboGetActive(combo_speciallities), speciallities)),
 					Util.FetchID(UtilGtk.ComboGetActive(combo_levels)),

Modified: trunk/src/gui/run.cs
==============================================================================
--- trunk/src/gui/run.cs	(original)
+++ trunk/src/gui/run.cs	Tue Mar 31 08:56:51 2009
@@ -60,6 +60,9 @@
 		EditRunWindowBox.pDN = pDN;
 		
 		EditRunWindowBox.initializeValues();
+		
+		if(myEvent.Type == "Margaria")
+			EditRunWindowBox.entry_description.Sensitive = false;
 
 		EditRunWindowBox.fillDialog (myEvent);
 

Modified: trunk/src/report.cs
==============================================================================
--- trunk/src/report.cs	(original)
+++ trunk/src/report.cs	Tue Mar 31 08:56:51 2009
@@ -113,16 +113,16 @@
 			myPersons = SqlitePersonSession.SelectCurrentSession(sessionID, false, false); //not onlyIDAndName, not reversed
 		}
 		if(ShowSimpleJumps) {
-			myJumps= SqliteJump.SelectJumps(sessionID, -1, "");
+			myJumps= SqliteJump.SelectJumps(sessionID, -1, "", "");
 		}
 		if(ShowReactiveJumps) {
 			myJumpsRj = SqliteJumpRj.SelectJumps(sessionID, -1, "");
 		}
 		if(ShowSimpleRuns) {
-			myRuns= SqliteRun.SelectAllRuns(sessionID, -1);
+			myRuns= SqliteRun.SelectRuns(sessionID, -1, "");
 		}
 		if (ShowIntervalRuns) {
-			myRunsInterval = SqliteRunInterval.SelectAllRuns(sessionID, -1);
+			myRunsInterval = SqliteRunInterval.SelectRuns(sessionID, -1);
 		}
 		if(ShowReactionTimes) {
 			myReactionTimes= SqliteReactionTime.SelectAllReactionTimes(sessionID, -1);

Modified: trunk/src/runType.cs
==============================================================================
--- trunk/src/runType.cs	(original)
+++ trunk/src/runType.cs	Tue Mar 31 08:56:51 2009
@@ -268,7 +268,7 @@
 			isPredefined	= true;
 			imageFileName = "margaria.png";
 			description	= Catalog.GetString("Margaria-Kalamen");
-			longDescription	= "";
+			longDescription	= ""; //TODO
 		} //interval
 		else if(name == "byLaps") {
 			hasIntervals 	= true; 

Modified: trunk/src/server.cs
==============================================================================
--- trunk/src/server.cs	(original)
+++ trunk/src/server.cs	Tue Mar 31 08:56:51 2009
@@ -164,7 +164,6 @@
 			int state = (int) Constants.ServerSessionStates.UPLOADINGSESSION;
 			//create ServerSession based on Session currentSession
 			ServerSession serverSession = new ServerSession(currentSession, evalSID, progName + " " + progVersion, 
-					//Util.GetOS(), Util.DateParse(DateTime.Now.ToString()), Constants.ServerSessionStates.UPLOADINGSESSION); 
 					Util.GetOS(), Util.DateParse(DateTime.Now.ToString()), state); 
 
 			//if uploading session for first time
@@ -230,7 +229,7 @@
 				int countE = 0;					
 				int countS = 0;					
 
-				string [] jumps = SqliteJump.SelectJumps(currentSession.UniqueID, person.UniqueID, "");
+				string [] jumps = SqliteJump.SelectJumps(currentSession.UniqueID, person.UniqueID, "", "");
 				foreach(string myJump in jumps) {
 					string [] js = myJump.Split(new char[] {':'});
 					//select jump
@@ -339,7 +338,7 @@
 				countE = 0;					
 				countS = 0;					
 
-				string [] runs = SqliteRun.SelectAllRuns(currentSession.UniqueID, person.UniqueID);
+				string [] runs = SqliteRun.SelectRuns(currentSession.UniqueID, person.UniqueID, "");
 				foreach(string myRun in runs) {
 					string [] js = myRun.Split(new char[] {':'});
 					//select run
@@ -381,7 +380,7 @@
 				countE = 0;					
 				countS = 0;					
 
-				string [] runsI = SqliteRunInterval.SelectAllRuns(currentSession.UniqueID, person.UniqueID);
+				string [] runsI = SqliteRunInterval.SelectRuns(currentSession.UniqueID, person.UniqueID);
 				foreach(string myRun in runsI) {
 					string [] js = myRun.Split(new char[] {':'});
 					//select run

Modified: trunk/src/sqlite/jump.cs
==============================================================================
--- trunk/src/sqlite/jump.cs	(original)
+++ trunk/src/sqlite/jump.cs	Tue Mar 31 08:56:51 2009
@@ -89,7 +89,8 @@
 	}
 	
 	//if all persons, put -1 in personID
-	public static string[] SelectJumps(int sessionID, int personID, string filterWeight) 
+	//if all types put, "" in filterType
+	public static string[] SelectJumps(int sessionID, int personID, string filterWeight, string filterType) 
 	{
 		string filterPersonString = "";
 		if(personID != -1)
@@ -99,6 +100,10 @@
 		if(filterWeight == "withWeight")
 			filterWeightString = " AND jump.weight != 0 ";
 
+		string filterTypeString = "";
+		if(filterType != "")
+			filterTypeString = " AND jump.type == '" + filterType + "' ";
+
 		dbcon.Open();
 		dbcmd.CommandText = "SELECT person.name, jump.*, personSessionWeight.weight " +
 			" FROM person, jump, personSessionWeight " +
@@ -106,6 +111,7 @@
 			" AND jump.sessionID == " + sessionID + 
 			filterPersonString +
 			filterWeightString +
+			filterTypeString +
 			" AND personSessionWeight.personID == person.uniqueID " +
 			" AND personSessionWeight.sessionID == jump.sessionID " +
 			" ORDER BY upper(person.name), jump.uniqueID";

Modified: trunk/src/sqlite/run.cs
==============================================================================
--- trunk/src/sqlite/run.cs	(original)
+++ trunk/src/sqlite/run.cs	Tue Mar 31 08:56:51 2009
@@ -81,11 +81,15 @@
 	}
 	
 	//if all persons, put -1 in personID
-	public static string[] SelectAllRuns(int sessionID, int personID) 
+	//if all types, put "" in filterType
+	public static string[] SelectRuns(int sessionID, int personID, string filterType) 
 	{
 		string filterPersonString = "";
 		if(personID != -1)
 			filterPersonString = " AND person.uniqueID == " + personID;
+		string filterTypeString = "";
+		if(filterType != "")
+			filterTypeString = " AND run.type == '" + filterType + "' " ;
 
 		dbcon.Open();
 		dbcmd.CommandText = "SELECT person.name, run.* " +
@@ -93,6 +97,7 @@
 			" WHERE person.uniqueID == run.personID" + 
 			" AND run.sessionID == " + sessionID + 
 			filterPersonString +
+			filterTypeString +
 			" ORDER BY upper(person.name), run.uniqueID";
 		
 		Log.WriteLine(dbcmd.CommandText.ToString());

Modified: trunk/src/sqlite/runInterval.cs
==============================================================================
--- trunk/src/sqlite/runInterval.cs	(original)
+++ trunk/src/sqlite/runInterval.cs	Tue Mar 31 08:56:51 2009
@@ -81,7 +81,7 @@
 		return myLast;
 	}
 
-	public new static string[] SelectAllRuns(int sessionID, int personID) 
+	public new static string[] SelectRuns(int sessionID, int personID) 
 	{
 		string filterPersonString = "";
 		if(personID != -1)

Modified: trunk/src/sqlite/session.cs
==============================================================================
--- trunk/src/sqlite/session.cs	(original)
+++ trunk/src/sqlite/session.cs	Tue Mar 31 08:56:51 2009
@@ -112,7 +112,12 @@
 	
 	public static Session Select(string myUniqueID)
 	{
-		dbcon.Open();
+		try {
+			dbcon.Open();
+		} catch {
+			//done because there's an eventual problem maybe thread related on very few starts of chronojump
+			Log.WriteLine("Catched dbcon problem at Session.Select");
+		}
 		dbcmd.CommandText = "SELECT * FROM " + Constants.SessionTable + " WHERE uniqueID == " + myUniqueID ; 
 		Log.WriteLine(dbcmd.CommandText.ToString());
 		
@@ -445,7 +450,7 @@
 
 	//called from gui/event.cs for doing the graph
 	//we need to know the avg of events of a type (SJ, CMJ, free (pulse).. of a person, or of all persons on the session
-	public static double SelectAllEventsOfAType(int sessionID, int personID, string table, string type, string valueToSelect) 
+	public static double SelectAVGEventsOfAType(int sessionID, int personID, string table, string type, string valueToSelect) 
 	{
 		//if personIDString == -1, the applies for all persons
 		



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