[chronojump] overview of encoder session is different for gravitatory and inertial
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] overview of encoder session is different for gravitatory and inertial
- Date: Thu, 9 Jun 2016 13:57:30 +0000 (UTC)
commit 2123440ac8ef8c450b4fe853381d5ee67cd1315f
Author: Xavier de Blas <xaviblas gmail com>
Date: Thu Jun 9 15:51:25 2016 +0200
overview of encoder session is different for gravitatory and inertial
src/gui/encoder.cs | 36 +++++++++++++++++++++++++-----------
src/sqlite/encoder.cs | 40 +++++++++++++++++++++++++++++++---------
2 files changed, 56 insertions(+), 20 deletions(-)
---
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 2c5b070..6336eda 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -1391,15 +1391,30 @@ public partial class ChronoJumpWindow
void on_menuitem_encoder_session_overview_activate (object o, EventArgs args)
{
- ArrayList dataPrint = SqliteEncoder.SelectSessionOverview(false, currentSession.UniqueID);
+ ArrayList dataPrint = SqliteEncoder.SelectSessionOverview(false, currentEncoderGI,
currentSession.UniqueID);
- string [] columnsString = {
- "Unused count",
- Catalog.GetString("Person"),
- Catalog.GetString("Exercise"),
- Catalog.GetString("Displaced mass"),
- Catalog.GetString("Sets")
- };
+ string title = "";
+ string [] columnsString;
+ if(currentEncoderGI == Constants.EncoderGI.GRAVITATORY) {
+ title = Catalog.GetString("Gravitory sets captured on this session");
+
+ columnsString = new string [] {
+ "Unused count",
+ Catalog.GetString("Person"),
+ Catalog.GetString("Exercise"),
+ Catalog.GetString("Displaced mass"),
+ Catalog.GetString("Sets")
+ };
+ } else {
+ title = Catalog.GetString("Inertial sets captured on this session");
+
+ columnsString = new string [] {
+ "Unused count",
+ Catalog.GetString("Person"),
+ Catalog.GetString("Exercise"),
+ Catalog.GetString("Sets")
+ };
+ }
ArrayList bigArray = new ArrayList();
ArrayList a1 = new ArrayList();
@@ -1409,8 +1424,7 @@ public partial class ChronoJumpWindow
bigArray.Add(a1);
genericWin = GenericWindow.Show(false, //don't show now
- "Sets captured on this session",
- bigArray);
+ title, bigArray);
ArrayList nonSensitiveRows = new ArrayList();
for(int i=0; i < dataPrint.Count; i ++)
diff --git a/src/sqlite/encoder.cs b/src/sqlite/encoder.cs
index 6234b0f..a413dce 100644
--- a/src/sqlite/encoder.cs
+++ b/src/sqlite/encoder.cs
@@ -461,13 +461,13 @@ class SqliteEncoder : Sqlite
return array;
}
- public static ArrayList SelectSessionOverview (bool dbconOpened, int sessionID)
+ public static ArrayList SelectSessionOverview (bool dbconOpened, Constants.EncoderGI encoderGI, int
sessionID)
{
if(! dbconOpened)
Sqlite.Open();
dbcmd.CommandText =
- "SELECT person77.name, encoderExercise.name, (personSession77.weight *
encoderExercise.percentBodyWeight/100) + encoder.extraWeight, COUNT(*)" +
+ "SELECT person77.name, encoder.encoderConfiguration, encoderExercise.name,
(personSession77.weight * encoderExercise.percentBodyWeight/100) + encoder.extraWeight, COUNT(*)" +
" FROM person77, personSession77, encoderExercise, encoder" +
" WHERE person77.uniqueID == encoder.personID AND personSession77.personID ==
encoder.personID AND personSession77.sessionID == encoder.sessionID AND
encoderExercise.uniqueID==encoder.exerciseID AND signalOrCurve == \"signal\" AND encoder.sessionID == " +
sessionID +
" GROUP BY encoder.personID, exerciseID, extraWeight" +
@@ -481,14 +481,36 @@ class SqliteEncoder : Sqlite
ArrayList array = new ArrayList();
int count = 0;
while(reader.Read()) {
- string [] s = {
- (count++).ToString(), //not displayed but needed on genericWin.SetTreeView
- reader[0].ToString(), //person name
- reader[1].ToString(), //encoder exercise name
- reader[2].ToString(), //displaced mass (includes percentBodyeight)
- reader[3].ToString() //sets count
+ //discard if != encoderGI
+ string [] strFull = reader[1].ToString().Split(new char[] {':'});
+ EncoderConfiguration econf = new EncoderConfiguration(
+ (Constants.EncoderConfigurationNames)
+ Enum.Parse(typeof(Constants.EncoderConfigurationNames), strFull[0]) );
+
+ //if encoderGI != ALL discard non wanted repetitions
+ if(encoderGI == Constants.EncoderGI.GRAVITATORY && econf.has_inertia)
+ continue;
+ else if(encoderGI == Constants.EncoderGI.INERTIAL && ! econf.has_inertia)
+ continue;
+
+ if(encoderGI == Constants.EncoderGI.GRAVITATORY) {
+ string [] s = {
+ (count++).ToString(), //not displayed but needed on
genericWin.SetTreeView
+ reader[0].ToString(), //person name
+ reader[2].ToString(), //encoder exercise name
+ reader[3].ToString(), //displaced mass (includes percentBodyeight)
+ reader[4].ToString() //sets count
+ };
+ array.Add (s);
+ } else {
+ string [] s = {
+ (count++).ToString(), //not displayed but needed on
genericWin.SetTreeView
+ reader[0].ToString(), //person name
+ reader[2].ToString(), //encoder exercise name
+ reader[4].ToString() //sets count
};
- array.Add (s);
+ array.Add (s);
+ }
}
reader.Close();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]