[chronojump] esport and report work (also with power)



commit 4cc49741b262775bbb843003063b528f39e83808
Author: Xavier de Blas <xaviblas gmail com>
Date:   Mon Mar 8 12:09:03 2010 +0800

    esport and report work (also with power)

 images/report_web_style.css |    8 +++---
 src/exportSession.cs        |   58 ++++++++++++++++++++----------------------
 src/gui/chronojump.cs       |    3 --
 src/report.cs               |    4 +-
 src/session.cs              |    9 +++---
 src/sqlite/speciallity.cs   |    3 ++
 6 files changed, 41 insertions(+), 44 deletions(-)
---
diff --git a/images/report_web_style.css b/images/report_web_style.css
index 80377e8..6ad5567 100644
--- a/images/report_web_style.css
+++ b/images/report_web_style.css
@@ -17,7 +17,7 @@ h1 {
 }
 
 h2 {
-	color: #556a80;
+	color: #6C77AB;
 	clear: both;
 	font-size:14pt;
 }
@@ -33,10 +33,10 @@ table {
 }
 
 th {
-	background-color:ddeeff;
-	color:333333;
+	background-color:ffffff;
+	color:6C77AB;
 	font-weight:bold;
-	font-size:10pt;
+	font-size:8pt;
 } 
 
 td {
diff --git a/src/exportSession.cs b/src/exportSession.cs
index be2c541..012d1f5 100644
--- a/src/exportSession.cs
+++ b/src/exportSession.cs
@@ -163,8 +163,7 @@ public class ExportSession
 	
 	protected virtual void getData() 
 	{
-		//myPersons = SqlitePersonSession.SelectCurrentSession(mySession.UniqueID, false, false); //not onlyIDAndName, not reversed
-		ArrayList myPersons = SqlitePersonSession.SelectCurrentSessionPersons(mySession.UniqueID);
+		myPersons = SqlitePersonSession.SelectCurrentSessionPersons(mySession.UniqueID);
 		myJumps= SqliteJump.SelectJumps(mySession.UniqueID, -1, "", "");
 		myJumpsRj = SqliteJumpRj.SelectJumps(mySession.UniqueID, -1, "", "");
 		myRuns= SqliteRun.SelectRuns(mySession.UniqueID, -1, "");
@@ -234,22 +233,8 @@ public class ExportSession
 		ArrayList myData = new ArrayList(1);
 		myData.Add ( "\n" + Catalog.GetString ("ID") + ":" + Catalog.GetString ("Name") + ":" +
 				Catalog.GetString ("Sex") + ":" + Catalog.GetString ("Date of Birth") + ":" +
-				Catalog.GetString ("Description")
-			   );
-		
-		foreach (Person p in myPersons) {
-			myData.Add(
-					p.UniqueID.ToString() + ":" + p.Name + ":" +
-					p.Sex + ":" + p.DateBorn.ToShortDateString() + ":" +
-					p.CountryID + ":" + Util.RemoveNewLine(p.Description)
-				  );
-		}
-		writeData(myData);
-		writeData("VERTICAL-SPACE");
-		
-		//PERSONSESSION STUFF
-		myData = new ArrayList(1);
-		myData.Add ( "\n" + Catalog.GetString ("Height") + ":" + Catalog.GetString("Weight") + ":" +
+				Catalog.GetString ("Description") + ":" + 
+				Catalog.GetString ("Height") + ":" + Catalog.GetString("Weight") + ":" +
 				Catalog.GetString ("Sport") + ":" + Catalog.GetString("Speciallity") + ":" +
 				Catalog.GetString ("Level") + ":" + Catalog.GetString ("Comments")
 			   );
@@ -258,13 +243,18 @@ public class ExportSession
 			PersonSession ps = SqlitePersonSession.Select(p.UniqueID, mySession.UniqueID);
 			string sportName = (SqliteSport.Select(ps.SportID)).Name;
 			string speciallityName = SqliteSpeciallity.Select(ps.SpeciallityID);
+			
 			myData.Add(
+					p.UniqueID.ToString() + ":" + p.Name + ":" +
+					p.Sex + ":" + p.DateBorn.ToShortDateString() + ":" +
+					Util.RemoveNewLine(p.Description) + ":" +
 					ps.Height + ":" + ps.Weight + ":" + 
 					sportName + ":" + speciallityName + ":" +
 					Util.FindLevelName(ps.Practice) + ":" +
 					Util.RemoveNewLine(ps.Comments)
 				  );
 		}
+		
 		writeData(myData);
 		writeData("VERTICAL-SPACE");
 	}
@@ -302,24 +292,32 @@ public class ExportSession
 
 			foreach (string jumpString in myJumps) {
 				string [] myStr = jumpString.Split(new char[] {':'});
-						
+					
+				double personWeight = SqlitePersonSession.SelectAttribute(
+						Convert.ToInt32(myStr[2]),
+						Convert.ToInt32(myStr[3]),
+						Constants.Weight);
+				double weightInKg = Util.WeightFromPercentToKg(
+							Convert.ToDouble(myStr[8]), 
+							personWeight);
+
 				string myWeight = "";
 				if(weightStatsPercent)
 					myWeight = myStr[8];
 				else
-					myWeight = Util.WeightFromPercentToKg(
-							Convert.ToDouble(myStr[8]), 
-							SqlitePersonSession.SelectAttribute(
-								Convert.ToInt32(myStr[2]),
-								Convert.ToInt32(myStr[3]),
-								Constants.Weight
-							)).ToString();
+					myWeight = weightInKg.ToString();
 		
 				double tc = Convert.ToDouble(myStr[6]);
 				double tf = Convert.ToDouble(myStr[5]);
-				string djPower = "-";
-				if(tc > 0 && tf > 0)
-					djPower = Util.TrimDecimals(Util.GetDjPower(tc, tf).ToString(), dec);
+
+
+				string power = "-";
+				if(tf > 0) {	
+					if(tc > 0) 		//dj
+						power = Util.TrimDecimals(Util.GetDjPower(tc, tf).ToString(), dec);
+					else 			//it's a normal jump without tc
+						power = Util.TrimDecimals(Util.GetPower(tf, personWeight, weightInKg).ToString(), dec);
+				}
 
 				myData.Add (	
 						myStr[2] + ":" +  myStr[0] + ":" +  	//person.UniqueID, person.Name
@@ -328,7 +326,7 @@ public class ExportSession
 						Util.TrimDecimals(myStr[5], dec) + ":" +  myStr[7] + ":" + 	//jump.tv, jump.fall
 						Util.TrimDecimals(myWeight, dec) + ":" +
 						Util.TrimDecimals(Util.GetHeightInCentimeters(myStr[5]), dec) + ":" +  
-						djPower + ":" +  
+						power + ":" +  
 						Util.TrimDecimals(Util.GetInitialSpeed(myStr[5], true), dec) + ":" +  //true: m/s
 						Util.RemoveNewLine(myStr[9]) + ":" +	//jump.description
 						Util.TrimDecimals(myStr[10],dec) + ":" +	//jump.angle
diff --git a/src/gui/chronojump.cs b/src/gui/chronojump.cs
index f6bfb67..ef4ea06 100644
--- a/src/gui/chronojump.cs
+++ b/src/gui/chronojump.cs
@@ -3905,9 +3905,6 @@ Console.WriteLine("X");
 		//if(!chronopicWin.Connected)	
 		//	currentEventExecute.SimulateInitValues(rand);
 
-		//TODO: MANAGE THE SENSITIVE OF WIDGETS!!!
-		//and what happens if no chronopic connected
-
 
 		//mark to only get inside on_multi_chronopic_finished one time
 		multiFinishing = false;
diff --git a/src/report.cs b/src/report.cs
index a528ff2..c6a3bcf 100644
--- a/src/report.cs
+++ b/src/report.cs
@@ -227,7 +227,7 @@ public class Report : ExportSession
 		writer.WriteLine("<img src=\"" +
 				Util.GetLastPartOfPath(Util.GetReportDirectoryName(fileName)) 
 				+ "/" + Constants.FileNameLogo + "\">\n ");
-		writer.WriteLine("</td><td width=\"80%\"><h1>Chronojump report</h1></td></tr>\n");
+		writer.WriteLine("</td><td width=\"80%\" valign=\"bottom\"><h1>Chronojump report</h1></td></tr>\n");
 		writer.WriteLine("</table>\n");
 			
 	}
@@ -243,7 +243,7 @@ public class Report : ExportSession
 				Catalog.GetString ("Comments")
 			  );
 		myData.Add ( mySession.UniqueID + ":" + mySession.Name + ":" +
-					mySession.Place + ":" + mySession.Date + ":" + mySession.Comments );
+					mySession.Place + ":" + mySession.DateShort + ":" + mySession.Comments );
 
 		writeData(myData);
 		writeData("VERTICAL-SPACE");
diff --git a/src/session.cs b/src/session.cs
index dd8a75b..3334c29 100644
--- a/src/session.cs
+++ b/src/session.cs
@@ -48,7 +48,7 @@ public partial class Session {
 	//With person sport stuff
 	public Session(string newUniqueID, string newName, string newPlace, DateTime newDate, 
 			int personsSportID, int personsSpeciallityID, int personsPractice,
-			string newComments, int serverUniqueID) 
+			string comments, int serverUniqueID) 
 	{
 		uniqueID = Convert.ToInt32(newUniqueID);
 		name = newName;
@@ -57,14 +57,14 @@ public partial class Session {
 		this.personsSportID = personsSportID;
 		this.personsSpeciallityID = personsSpeciallityID;
 		this.personsPractice = personsPractice;
-		comments = newComments;
+		this.comments = comments;
 		this.serverUniqueID = serverUniqueID; //remember don't do this on server
 	}
 
 	//typical constructor with personsSport stuff
 	public Session(string newName, string newPlace, DateTime newDate, 
 			int personsSportID, int personsSpeciallityID, int personsPractice,
-			string newComments, int serverUniqueID) 
+			string comments, int serverUniqueID) 
 	{
 		name = newName;
 		place = newPlace;
@@ -72,11 +72,10 @@ public partial class Session {
 		this.personsSportID = personsSportID;
 		this.personsSpeciallityID = personsSpeciallityID;
 		this.personsPractice = personsPractice;
-		comments = newComments;
 
 		name = Util.RemoveTildeAndColon(name);
 		place = Util.RemoveTildeAndColon(place);
-		comments = Util.RemoveTildeAndColon(comments);
+		this.comments = Util.RemoveTildeAndColon(comments);
 		this.serverUniqueID = serverUniqueID; //remember don't do this on server
 
 		/*
diff --git a/src/sqlite/speciallity.cs b/src/sqlite/speciallity.cs
index 2e7f462..d2c1199 100644
--- a/src/sqlite/speciallity.cs
+++ b/src/sqlite/speciallity.cs
@@ -75,6 +75,9 @@ class SqliteSpeciallity : Sqlite
 
 	public static string Select(int uniqueID)
 	{
+		if(uniqueID == -1)
+			return "";
+
 		dbcon.Open();
 		
 		dbcmd.CommandText = "SELECT name FROM " + Constants.SpeciallityTable + " WHERE uniqueID == " + uniqueID;



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