Commit 2355827e authored by Xavier de Blas's avatar Xavier de Blas

report prints session, persons, all jumps and runs

report to UTF-8 solved latin char problems
parent 0878f48f
CHANGELOG:
20 set 2005
report prints session, persons, all jumps and runs
report to UTF-8 solved latin char problems
19 set 2005
report of all stats and graphs done (TODO: improve graph size and info
to user included in HTML) (task 295 at 90%)
......
No preview for this file type
......@@ -7381,7 +7381,7 @@ options</property>
<property name="border_width">10</property>
<property name="height_request">480</property>
<property name="visible">True</property>
<property name="title" translatable="yes">Statistics</property>
<property name="title" translatable="yes">Chronojump Statistics window</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
......@@ -11524,10 +11524,10 @@ If you need more, just repeat the operation later</property>
<widget class="GtkWindow" id="report_window">
<property name="border_width">10</property>
<property name="width_request">400</property>
<property name="width_request">550</property>
<property name="height_request">420</property>
<property name="visible">True</property>
<property name="title" translatable="yes">Make report</property>
<property name="title" translatable="yes">Chronojump Report window</property>
<property name="type">GTK_WINDOW_TOPLEVEL</property>
<property name="window_position">GTK_WIN_POS_NONE</property>
<property name="modal">False</property>
......
......@@ -25,7 +25,7 @@ using Gtk;
using Gdk;
using Glade;
using Gnome;
using System.Collections; //ArrayList
//using System.Collections; //ArrayList
public class ChronoJump
......@@ -1284,6 +1284,11 @@ public class ChronoJump
statsWin.FillTreeView_stats(false, true);
}
//pass to report
report.PrefsDigitsNumber = prefsDigitsNumber;
report.HeightPreferred = heightPreferred;
report.WeightStatsPercent = weightStatsPercent;
}
private void on_cancel_clicked (object o, EventArgs args)
......
......@@ -24,6 +24,7 @@ using System.Data;
using System.IO; //TextWriter
using System.Xml; //XmlTextWriter
using Gtk; //FileSelection widget
using System.Collections; //ArrayList
public class ExportSession
{
......@@ -65,7 +66,10 @@ public class ExportSession
//from: http://www.gnomebangalore.org/?q=node/view/467
if ( (Gtk.ResponseType) fs.Run () != Gtk.ResponseType.Ok) {
Console.WriteLine("cancelled");
myAppbar.Push ( Catalog.GetString ("Cancelled") );
//report does not currently send the appBar reference
if(formatFile != "report") {
myAppbar.Push ( Catalog.GetString ("Cancelled") );
}
fs.Hide ();
return ;
}
......@@ -126,7 +130,7 @@ public class ExportSession
protected virtual void printData ()
{
printHeader();
printSessionInfo();
printJumpers();
printJumps();
printJumpsRj();
......@@ -135,28 +139,195 @@ public class ExportSession
printFooter();
}
protected virtual void printHeader()
protected virtual void writeData (ArrayList exportData) {
}
protected virtual void writeData (string exportData) {
}
protected void printSessionInfo()
{
ArrayList myData = new ArrayList(2);
myData.Add( "\n" +
Catalog.GetString ("SessionID") + ":" +
Catalog.GetString ("Name") + ":" +
Catalog.GetString ("Place") + ":" +
Catalog.GetString ("Date") + ":" +
Catalog.GetString ("Comments") );
myData.Add ( mySession.UniqueID + ":" + mySession.Name + ":" +
mySession.Place + ":" + mySession.Date + ":" + mySession.Comments );
writeData(myData);
}
protected virtual void printJumpers()
protected void printJumpers()
{
ArrayList myData = new ArrayList(1);
myData.Add ( "\n" + Catalog.GetString ("ID") + ":" + Catalog.GetString ("Name"));
foreach (string jumperString in myPersons) {
string [] myStr = jumperString.Split(new char[] {':'});
myData.Add(myStr[0] + ":" + myStr[1]); //person.id, person.name
}
writeData(myData);
}
protected virtual void printJumps()
protected void printJumps()
{
ArrayList myData = new ArrayList(1);
myData.Add( "\n" +
Catalog.GetString("Jumper name") + ":" +
Catalog.GetString("jump ID") + ":" +
Catalog.GetString("Type") + ":" +
"TV:" +
"TC:" +
Catalog.GetString("Fall") + ":" +
Catalog.GetString("Weight") + ":" +
Catalog.GetString("Height") + ":" +
Catalog.GetString("Initial Speed") + ":" +
Catalog.GetString("Description") );
foreach (string jumpString in myJumps) {
string [] myStr = jumpString.Split(new char[] {':'});
myData.Add (
myStr[0] + ":" + myStr[1] + ":" + //person.name, jump.uniqueID
//myStr[2] + ":" + myStr[3] + ":" + //jump.personID, jump.sessionID
myStr[4] + ":" + myStr[5] + ":" + //jump.type, jump.tv
myStr[6] + ":" + myStr[7] + ":" + //jump.tc, jump.fall
myStr[8] + ":" + //jump.weight,
Util.GetHeightInCentimeters(myStr[5]) + ":" +
Util.GetInitialSpeed(myStr[5]) + ":" +
myStr[9] //jump.description
);
}
writeData(myData);
}
protected virtual void printJumpsRj()
protected void printJumpsRj()
{
foreach (string jump in myJumpsRj) {
ArrayList myData = new ArrayList(1);
myData.Add( "\n" +
Catalog.GetString("Jumper name") + ":" +
Catalog.GetString("jump ID") + ":" +
Catalog.GetString("jump Type") + ":" +
Catalog.GetString("TC Max") + ":" +
Catalog.GetString("TV Max") + ":" +
Catalog.GetString("Max Height") + ":" +
Catalog.GetString("Max Initial Speed") + ":" +
Catalog.GetString("TC AVG") + ":" +
Catalog.GetString("TV AVG") + ":" +
Catalog.GetString("AVG Height") + ":" +
Catalog.GetString("AVG Initial Speed") + ":" +
Catalog.GetString("Fall") + ":" +
Catalog.GetString("Weight") + ":" +
Catalog.GetString("Jumps") + ":" +
Catalog.GetString("Time") + ":" +
Catalog.GetString("Limited") + ":" +
Catalog.GetString("Description" ) );
string [] myStr = jump.Split(new char[] {':'});
myData.Add (
myStr[0] + ":" + myStr[1] + ":" + //person.name, jumpRj.uniqueID
//myStr[2] + ":" + myStr[3] + ":" + //jumpRj.personID, jumpRj.sessionID
myStr[4] + ":" + //jumpRj.type
myStr[6] + ":" + //jumpRj.tcMax
myStr[5] + ":" + //jumpRj.tvMax
Util.GetHeightInCentimeters(myStr[5]) + ":" + //Max height
Util.GetInitialSpeed(myStr[5]) + ":" + //Max initial speed
myStr[11] + ":" + //jumpRj.tcAvg
myStr[10] + ":" + //jumpRj.tvAvg
Util.GetHeightInCentimeters(myStr[10]) + ":" + //Avg height
Util.GetInitialSpeed(myStr[10]) + ":" + //Avg Initial speed
myStr[7] + ":" + //jumpRj.Fall
myStr[8] + ":" + myStr[14] + ":" + //jumpRj.Weight, jumpRj.Jumps
myStr[15] + ":" + myStr[16] + ":" + //jumpRj.Time, jumpRj.Limited
myStr[9] //jumpRj.Description
);
writeData(myData);
myData = new ArrayList(1);
//print tvString and tcString
string [] tvString = myStr[12].Split(new char[] {'='});
string [] tcString = myStr[13].Split(new char[] {'='});
int count = 0;
myData.Add( Catalog.GetString ( "TV:TC" ) );
foreach(string myTv in tvString) {
myData.Add(myTv + ":" + tcString[count]);
count ++;
}
writeData(myData);
writeData("VERTICAL-SPACE");
}
}
protected virtual void printRuns()
protected void printRuns()
{
ArrayList myData = new ArrayList(1);
myData.Add( "\n" +
Catalog.GetString("Runner name") + ":" +
Catalog.GetString("run ID") + ":" +
Catalog.GetString("Type") + ":" +
Catalog.GetString("Distance") + ":" +
Catalog.GetString("Time") + ":" +
Catalog.GetString("Speed") + ":" +
Catalog.GetString("Description") );
foreach (string runString in myRuns) {
string [] myStr = runString.Split(new char[] {':'});
myData.Add (
myStr[0] + ":" + myStr[1] + ":" + //person.name, run.uniqueID
myStr[4] + ":" + myStr[5] + ":" + //run.type, run.distance
myStr[6] + ":" + Util.GetSpeed(myStr[5], myStr[6]) + ":" + //run.time, speed
myStr[7] //run.description
);
}
writeData(myData);
}
protected virtual void printRunsInterval()
protected void printRunsInterval()
{
foreach (string runString in myRunsInterval) {
ArrayList myData = new ArrayList(1);
myData.Add( "\n" +
Catalog.GetString("Runner name") + ":" +
Catalog.GetString("run ID") + ":" +
Catalog.GetString("Type") + ":" +
Catalog.GetString("Distance total") + ":" +
Catalog.GetString("Time total") + ":" +
Catalog.GetString("Average speed") + ":" +
Catalog.GetString("Distance interval") + ":" +
Catalog.GetString("Tracks") + ":" +
Catalog.GetString("Limited") + ":" +
Catalog.GetString("Description") );
string [] myStr = runString.Split(new char[] {':'});
myData.Add (
myStr[0] + ":" + myStr[1] + ":" + //person.name, run.uniqueID
myStr[4] + ":" + myStr[5] + ":" + //run.type, run.distancetotal
myStr[6] + ":" + //run.timetotal
Util.GetSpeed(myStr[5], myStr[6]) + ":" + //speed AVG
myStr[7] + ":" + //run.distanceInterval
myStr[9] + ":" + myStr[11] + ":" + //tracks, limited
myStr[10] //description
);
writeData(myData);
myData = new ArrayList(1);
//print intervalTimesString
string [] timeString = myStr[8].Split(new char[] {'='});
myData.Add( Catalog.GetString ( "Interval speed:interval times" ) );
foreach(string myTime in timeString) {
myData.Add(Util.GetSpeed(myStr[7], myTime) + ":" + myTime);
}
writeData(myData);
writeData("VERTICAL-SPACE");
}
}
protected virtual void printFooter()
......@@ -182,118 +353,19 @@ public class ExportSessionCSV : ExportSession
myAppbar = mainAppbar;
checkFile("CSV");
}
protected override void printHeader()
{
//writer.WriteLine( Catalog.GetString ( "SessionID, Name, Place, Date, Comments" ) );
writer.WriteLine(
Catalog.GetString ("SessionID") + ", " +
Catalog.GetString ("Name") + ", " +
Catalog.GetString ("Place") + ", " +
Catalog.GetString ("Date") + ", " +
Catalog.GetString ("Comments") );
writer.WriteLine( "{0}, {1}, {2}, {3}, {4}", mySession.UniqueID, mySession.Name,
mySession.Place, mySession.Date, mySession.Comments );
}
protected override void printJumpers()
{
writer.WriteLine( "\n" + Catalog.GetString ( "Jumpers" ) );
foreach (string jumperString in myPersons) {
string [] myStr = jumperString.Split(new char[] {':'});
writer.WriteLine ("{0}, {1}",
myStr[0], myStr[1] //person.id, person.name
);
}
}
protected override void printJumps()
{
writer.WriteLine( "\n" + Catalog.GetString ( "Normal Jumps" ) );
writer.WriteLine( "\n" +
Catalog.GetString("Jumper name") + ", " +
Catalog.GetString("jump ID") + ", " +
Catalog.GetString("Type") + ", " +
"TV, " +
"TC, " +
Catalog.GetString("Fall") + ", " +
Catalog.GetString("Weight") + ", " +
Catalog.GetString("Height") + ", " +
Catalog.GetString("Initial Speed") + ", " +
Catalog.GetString("Description") );
foreach (string jumpString in myJumps) {
string [] myStr = jumpString.Split(new char[] {':'});
writer.WriteLine ("{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}",
myStr[0], myStr[1], //person.name, jump.uniqueID
//myStr[2], myStr[3], //jump.personID, jump.sessionID
myStr[4], myStr[5], //jump.type, jump.tv
myStr[6], myStr[7], //jump.tc, jump.fall
myStr[8], //jump.weight,
Util.GetHeightInCentimeters(myStr[5]),
Util.GetInitialSpeed(myStr[5]),
myStr[9] //jump.description
);
}
}
protected override void printJumpsRj()
{
writer.WriteLine( "\n" + Catalog.GetString ( "Reactive Jumps" ) );
foreach (string jump in myJumpsRj) {
string [] myStr = jump.Split(new char[] {':'});
writer.WriteLine( "\n" +
Catalog.GetString("Jumper name") + ", " +
Catalog.GetString("jump ID") + ", " +
Catalog.GetString("jump Type") + ", " +
Catalog.GetString("TC Max") + ", " +
Catalog.GetString("TV Max") + ", " +
Catalog.GetString("Max Height") + ", " +
Catalog.GetString("Max Initial Speed") + ", " +
Catalog.GetString("TC AVG") + ", " +
Catalog.GetString("TV AVG") + ", " +
Catalog.GetString("AVG Height") + ", " +
Catalog.GetString("AVG Initial Speed") + ", " +
Catalog.GetString("Fall") + ", " +
Catalog.GetString("Weight") + ", " +
Catalog.GetString("Jumps") + ", " +
Catalog.GetString("Time") + ", " +
Catalog.GetString("Limited") + ", " +
Catalog.GetString("Description" ) );
writer.WriteLine ("{0}, {1}, {2}, {3}, {4}, {5}, {6}, {7}, {8}, {9}, {10}, {11}, {12}, {13}, {14}, {15}, {16}",
myStr[0], myStr[1], //person.name, jumpRj.uniqueID
//myStr[2], myStr[3], //jumpRj.personID, jumpRj.sessionID
myStr[4], //jumpRj.type
myStr[6], //jumpRj.tcMax
myStr[5], //jumpRj.tvMax
Util.GetHeightInCentimeters(myStr[5]), //Max height
Util.GetInitialSpeed(myStr[5]), //Max initial speed
myStr[11], //jumpRj.tcAvg
myStr[10], //jumpRj.tvAvg
Util.GetHeightInCentimeters(myStr[10]), //Avg height
Util.GetInitialSpeed(myStr[10]), //Avg Initial speed
myStr[7], //jumpRj.Fall
myStr[8], myStr[14], //jumpRj.Weight, jumpRj.Jumps
myStr[15], myStr[16], //jumpRj.Time, jumpRj.Limited
myStr[9] //jumpRj.Description
);
//print tvString and tcString
string [] tvString = myStr[12].Split(new char[] {'='});
string [] tcString = myStr[13].Split(new char[] {'='});
int count = 0;
writer.WriteLine( Catalog.GetString ( "TV, TC" ) );
foreach(string myTv in tvString) {
writer.WriteLine("{0}, {1}", myTv, tcString[count]);
count ++;
}
protected override void writeData (ArrayList exportData) {
for(int i=0; i < exportData.Count ; i++) {
exportData[i] = exportData[i].ToString().Replace(":", ", ");
writer.WriteLine( exportData[i] );
}
}
protected override void writeData (string exportData) {
//do nothing
}
/*
protected override void printRuns()
{
writer.WriteLine( "\n" + Catalog.GetString ( "Normal Runs" ) );
......@@ -354,6 +426,7 @@ public class ExportSessionCSV : ExportSession
}
}
}
*/
protected override void printFooter()
{
......@@ -412,30 +485,6 @@ public class ExportSessionXML : ExportSession
*/
//}
protected override void printHeader()
{
}
protected override void printJumpers()
{
}
protected override void printJumps()
{
}
protected override void printJumpsRj()
{
}
protected override void printRuns()
{
}
protected override void printRunsInterval()
{
}
protected override void printFooter()
{
//xr.Flush();
......
......@@ -59,7 +59,7 @@ public class Report : ExportSession
StatisticsData = new ArrayList(2);
//createIniStatisticsData();
mySession = SqliteSession.Select(sessionID.ToString());
}
public Report(int sessionID, bool showCurrentSessionData, bool showCurrentSessionJumpers,
......@@ -74,30 +74,10 @@ public class Report : ExportSession
this.ShowSimpleRuns = showSimpleRuns;
this.ShowIntervalRuns = showIntervalRuns;
this.StatisticsData = statisticsData;
mySession = SqliteSession.Select(sessionID.ToString());
}
/*
private void createIniStatisticsData ()
{
StatisticsData.Add("hello" + ":" + "i" + ":" + "like" + ":" +
"this" + ":" + "thing" + ":" + "a lot");
StatisticsData.Add("hello2" + ":" + "i" + ":" + "like2" + ":" +
"this" + ":" + "thing" + ":" + "a lot");
StatisticsData.Add("hello3" + ":" + "i" + ":" + "like" + ":" +
"this" + ":" + "thing" + ":" + "a lot3");
}
*/
/*
//public method for adding stats to the treeview
public void Add(string type, string subtype, string applyTo,
string sessionString, string showJumps, bool showSex)
{
StatisticsData.Add(type + ":" + subtype + ":" + applyTo + ":" +
sessionString + ":" + showJumps + ":" + showSex);
}
*/
public void PrepareFile () {
checkFile("report");
}
......@@ -116,10 +96,6 @@ public class Report : ExportSession
}
}
//session stuff?
if(ShowCurrentSessionJumpers) {
myPersons = SqlitePersonSession.SelectCurrentSession(sessionID);
}
......@@ -140,23 +116,30 @@ public class Report : ExportSession
protected override void printData ()
{
printHeader();
printHtmlHeader();
//session stuff?
if(ShowCurrentSessionData) {
writer.WriteLine("<h2>Session</h2>");
printSessionInfo();
}
if(ShowCurrentSessionJumpers) {
writer.WriteLine("<h2>Persons</h2>");
printJumpers();
}
if(ShowSimpleJumps) {
writer.WriteLine("<h2>Simple jumps</h2>");
printJumps();
}
if(ShowReactiveJumps) {
writer.WriteLine("<h2>Reaactive jumps</h2>");
printJumpsRj();
}
if(ShowSimpleRuns) {
writer.WriteLine("<h2>Simple runs</h2>");
printRuns();
}
if (ShowIntervalRuns) {
writer.WriteLine("<h2>Interval runs</h2>");
printRunsInterval();
}
......@@ -165,22 +148,32 @@ public class Report : ExportSession
printFooter();
}
protected override void printHeader()
protected void printHtmlHeader()
{
writer.WriteLine("<HTML><HEAD><TITLE>Chronojump Report (insert date)</TITLE>\n");
writer.WriteLine("<meta HTTP-EQUIV=\" Content-Type\" CONTENT=\"text/html; charset=ISO-8859-1\">\n");
writer.WriteLine("<meta HTTP-EQUIV=\" Content-Type\" CONTENT=\"text/html; charset=UTF-8\">\n");
writer.WriteLine("</HEAD>\n<BODY BGCOLOR=\"#ffffff\" TEXT=\"#444444\">\n");
}
protected override void printJumpers()
{
writer.WriteLine("<h2>jumpers</h2>");
protected override void writeData (ArrayList exportData) {
writer.WriteLine( "<table border=\"1\">" );
string iniCell = "<th>";
string endCell = "</th>";
for(int i=0; i < exportData.Count ; i++) {
exportData[i] = exportData[i].ToString().Replace(":", endCell + iniCell);
writer.WriteLine( "<tr>" + iniCell + exportData[i] + endCell + "</tr>" );
iniCell = "<td>";
endCell = "</td>";
}
writer.WriteLine( "</table>\n" );
}
protected override void printJumps()
protected override void writeData (string exportData)
{
writer.WriteLine("<h2>Simple jumps</h2>");
if(exportData == "VERTICAL-SPACE") {
writer.WriteLine( "<br>" );
}
}
protected void printStats()
......@@ -198,8 +191,8 @@ public class Report : ExportSession
//separate in sessions
string [] sessionsStrFull = strFull[3].Split(new char[] {':'});
for (int j=0; j < sessionsStrFull.Length ; j++) {
Session mySession = SqliteSession.Select(sessionsStrFull[j]);
sendSelectedSessions.Add(mySession.UniqueID + ":" + mySession.Name + ":" + mySession.Date);
Session tempSession = SqliteSession.Select(sessionsStrFull[j]);
sendSelectedSessions.Add(tempSession.UniqueID + ":" + tempSession.Name + ":" + tempSession.Date);
}
string applyTo = strFull[2];
......@@ -282,21 +275,6 @@ public class Report : ExportSession
}
}
protected override void printJumpsRj()
{
writer.WriteLine("<h2>jumpsRj</h2>");
}
protected override void printRuns()
{
writer.WriteLine("<h2>runs</h2>");
}
protected override void printRunsInterval()
{
writer.WriteLine("<h2>runsInterval</h2>");
}
protected override void printFooter()
{
writer.WriteLine("\n</BODY></HTML>");
......@@ -304,7 +282,10 @@ public class Report : ExportSession
public int SessionID {
set { sessionID = value; }
set {
sessionID = value;
mySession = SqliteSession.Select(sessionID.ToString());
}
}
public int PrefsDigitsNumber {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment