[chronojump] stats run simple done: remaining multisession (crashes) and graphs
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] stats run simple done: remaining multisession (crashes) and graphs
- Date: Fri, 18 Feb 2011 12:25:29 +0000 (UTC)
commit a940d3c820c7863679018e1c51316a413876a93b
Author: Xavier de Blas <xaviblas gmail com>
Date: Fri Feb 18 13:24:57 2011 +0100
stats run simple done: remaining multisession (crashes) and graphs
glade/chronojump.glade | 4 +-
po/POTFILES.in | 1 +
src/Makefile.am | 1 +
src/constants.cs | 1 +
src/gui/stats.cs | 12 ++++++
src/sqlite/stat.cs | 91 ++++++++++++++++++++++++++++++++++++++++++++++++
src/statType.cs | 19 ++++++++++
7 files changed, 127 insertions(+), 2 deletions(-)
---
diff --git a/glade/chronojump.glade b/glade/chronojump.glade
index ea64f54..65e9e19 100644
--- a/glade/chronojump.glade
+++ b/glade/chronojump.glade
@@ -3937,7 +3937,7 @@ options</property>
<property name="row_spacing">8</property>
<child>
<widget class="GtkRadioButton" id="radiobutton_stats_jumps_person_average">
- <property name="label" translatable="yes">Jumper's average</property>
+ <property name="label" translatable="yes">Person's average</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
@@ -3988,7 +3988,7 @@ options</property>
</child>
<child>
<widget class="GtkRadioButton" id="radiobutton_stats_jumps_person_bests">
- <property name="label" translatable="yes">Jumper's bests</property>
+ <property name="label" translatable="yes">Person's bests</property>
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="receives_default">False</property>
diff --git a/po/POTFILES.in b/po/POTFILES.in
index e83e41a..43c2ffb 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -70,6 +70,7 @@ src/stats/rjAVGSD.cs
src/stats/rjEvolution.cs
src/stats/rjIndex.cs
src/stats/rjPotencyBosco.cs
+src/stats/runSimple.cs
src/stats/sjCmjAbk.cs
src/stats/sjCmjAbkPlus.cs
src/treeViewEvent.cs
diff --git a/src/Makefile.am b/src/Makefile.am
index eb8d84e..3f77dba 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -114,6 +114,7 @@ FILES = \
stats/fv.cs\
stats/potency.cs\
stats/rjAVGSD.cs\
+ stats/runSimple.cs\
stats/graphs/graphData.cs\
stats/graphs/graphROptions.cs\
stats/graphs/graphSerie.cs\
diff --git a/src/constants.cs b/src/constants.cs
index e099ca1..f68b380 100644
--- a/src/constants.cs
+++ b/src/constants.cs
@@ -236,6 +236,7 @@ public class Constants
public static string TypeJumpsSimple = Catalog.GetString("Jumps: Simple");
public static string TypeJumpsSimpleWithTC = Catalog.GetString("Jumps: Simple with TC");
public static string TypeJumpsReactive = Catalog.GetString("Jumps: Reactive");
+ public static string TypeRunsSimple = Catalog.GetString("Runs: Simple");
//strings
public static string AllJumpsName = Catalog.GetString("See all jumps");
diff --git a/src/gui/stats.cs b/src/gui/stats.cs
index 9d05afd..d44dc25 100644
--- a/src/gui/stats.cs
+++ b/src/gui/stats.cs
@@ -128,6 +128,7 @@ public class StatsWindow {
Constants.TypeJumpsSimple,
Constants.TypeJumpsSimpleWithTC,
Constants.TypeJumpsReactive,
+ Constants.TypeRunsSimple,
};
private static string [] comboStatsSubTypeWithTCOptions = {
@@ -578,6 +579,17 @@ public class StatsWindow {
combo_stats_stat_apply_to.Sensitive = true;
combo_stats_stat_apply_to.Active = 0;
}
+ else if (UtilGtk.ComboGetActive(combo_stats_stat_type) == Constants.TypeRunsSimple )
+ {
+ UtilGtk.ComboUpdate(combo_stats_stat_subtype, comboStatsSubTypeSimpleOptions, "");
+ combo_stats_stat_subtype.Sensitive = false;
+ combo_stats_stat_subtype.Active = 0;
+
+ UtilGtk.ComboUpdate(combo_stats_stat_apply_to,
+ SqliteRunType.SelectRunTypes(Constants.AllRunsName, true), ""); //only select name
+ combo_stats_stat_apply_to.Sensitive = true;
+ combo_stats_stat_apply_to.Active = 0;
+ }
fillTreeView_stats(false);
}
diff --git a/src/sqlite/stat.cs b/src/sqlite/stat.cs
index 31a6af7..2e8a9f5 100644
--- a/src/sqlite/stat.cs
+++ b/src/sqlite/stat.cs
@@ -1059,6 +1059,97 @@ class SqliteStat : Sqlite
return myArray;
}
+ public static ArrayList RunSimple (string sessionString, bool multisession, string operationString, string runType, bool showSex)
+ {
+ string tp = Constants.PersonTable;
+
+ string ini = "";
+ string end = "";
+ if(operationString == "MAX") {
+ ini = "MAX(";
+ end = ")";
+ } else if(operationString == "AVG") {
+ ini = "AVG(";
+ end = ")";
+ }
+
+ string orderByString = "ORDER BY ";
+ string moreSelect = "";
+ moreSelect = ini + "run.time" + end;
+
+ string fromString = " FROM run, " + tp + " ";
+ string runTypeString = " AND run.type == '" + runType + "' ";
+ if(runType == Constants.AllRunsName) {
+ moreSelect = moreSelect + ", run.type ";
+ fromString = " FROM run, " + tp + ", runType ";
+ runTypeString = " AND run.Type == runType.name ";
+ }
+
+
+ //if we use AVG or MAX, then we have to group by the results
+ //if there's more than one session, it sends the avg or max
+ string groupByString = "";
+ if (ini.Length > 0) {
+ groupByString = " GROUP BY run.personID, run.sessionID ";
+ }
+ //if multisession, order by person.name, sessionID for being able to present results later
+ if(multisession) {
+ orderByString = orderByString + tp + ".name, sessionID, ";
+ }
+
+ dbcon.Open();
+ dbcmd.CommandText = "SELECT " + tp + ".name, " + tp + ".sex, sessionID, " + moreSelect +
+ fromString +
+ sessionString +
+ runTypeString +
+ " AND run.personID == " + tp + ".uniqueID " +
+ groupByString +
+ orderByString + ini + "run.time " + end + " DESC ";
+
+ Log.WriteLine(dbcmd.CommandText.ToString());
+ dbcmd.ExecuteNonQuery();
+
+ SqliteDataReader reader;
+ reader = dbcmd.ExecuteReader();
+
+ string showSexString = "";
+ ArrayList myArray = new ArrayList(2);
+ while(reader.Read()) {
+ if(showSex) {
+ showSexString = "." + reader[1].ToString() ;
+ }
+
+ if(multisession) {
+ string returnSessionString = ":" + reader[2].ToString();
+ string returnValueString = "";
+ /*
+ if(heightPreferred) {
+ returnValueString = ":" + Util.GetHeightInCentimeters(
+ Util.ChangeDecimalSeparator(reader[3].ToString()));
+ } else {
+ returnValueString = ":" + reader[3].ToString();
+ }
+ */
+ myArray.Add (reader[0].ToString() + showSexString +
+ returnSessionString + //session
+ returnValueString //time
+ );
+ } else {
+ //in simple session return: name, sex, height, TF
+ myArray.Add (reader[0].ToString() + showSexString +
+ /*
+ ":" + Util.GetHeightInCentimeters(
+ Util.ChangeDecimalSeparator(reader[3].ToString())) +
+ */
+ ":" + Util.ChangeDecimalSeparator(reader[3].ToString())
+ );
+ }
+ }
+ reader.Close();
+ dbcon.Close();
+ return myArray;
+ }
+
/*
public static ArrayList GlobalNormal (string sessionString, string operation, bool sexSeparated,
int personID, bool heightPreferred)
diff --git a/src/statType.cs b/src/statType.cs
index f0de7cd..b7dffea 100644
--- a/src/statType.cs
+++ b/src/statType.cs
@@ -368,6 +368,25 @@ public class StatType {
}
}
}
+ else if(statisticType == Constants.TypeRunsSimple)
+ {
+ if(statisticApplyTo.Length == 0) {
+ Log.WriteLine("Simple-ret");
+ return false;
+ }
+
+ //only no indexes now
+ //if(statisticSubType == Catalog.GetString("No indexes"))
+ //{
+ //RunType myType = new RunType(statisticApplyTo);
+ if(graph) {
+ //myStat = new GraphRunSimple (myStatTypeStruct);
+ myStat = new StatRunSimple (myStatTypeStruct, treeview_stats);
+ } else {
+ myStat = new StatRunSimple (myStatTypeStruct, treeview_stats);
+ }
+ //}
+ }
myStat.FakeButtonRowCheckedUnchecked.Clicked +=
new EventHandler(on_fake_button_row_checked_clicked);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]