[chronojump] 1RM window is intersession
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] 1RM window is intersession
- Date: Mon, 30 May 2016 14:17:01 +0000 (UTC)
commit dced847b1db9853cfe4c5c08e2183a3810866d51
Author: Xavier de Blas <xaviblas gmail com>
Date: Mon May 30 15:51:07 2016 +0200
1RM window is intersession
src/encoder.cs | 9 ++++++---
src/gui/encoder.cs | 5 +++--
src/sqlite/encoder.cs | 13 ++++++++-----
3 files changed, 17 insertions(+), 10 deletions(-)
---
diff --git a/src/encoder.cs b/src/encoder.cs
index 5bd4cd8..ad00c67 100644
--- a/src/encoder.cs
+++ b/src/encoder.cs
@@ -933,6 +933,7 @@ public class Encoder1RM
public int uniqueID;
public int personID;
public int sessionID;
+ public DateTime date;
public int exerciseID;
public double load1RM;
@@ -942,20 +943,22 @@ public class Encoder1RM
public Encoder1RM() {
}
- public Encoder1RM(int uniqueID, int personID, int sessionID, int exerciseID, double load1RM)
+ public Encoder1RM(int uniqueID, int personID, int sessionID, DateTime date, int exerciseID, double
load1RM)
{
this.uniqueID = uniqueID;
this.personID = personID;
this.sessionID = sessionID;
+ this.date = date;
this.exerciseID = exerciseID;
this.load1RM = load1RM;
}
- public Encoder1RM(int uniqueID, int personID, int sessionID, int exerciseID, double load1RM, string
personName, string exerciseName)
+ public Encoder1RM(int uniqueID, int personID, int sessionID, DateTime date, int exerciseID, double
load1RM, string personName, string exerciseName)
{
this.uniqueID = uniqueID;
this.personID = personID;
this.sessionID = sessionID;
+ this.date = date;
this.exerciseID = exerciseID;
this.load1RM = load1RM;
this.personName = personName;
@@ -968,7 +971,7 @@ public class Encoder1RM
}
public string [] ToStringArray2() {
- string [] s = { uniqueID.ToString(), personName, exerciseName, load1RM.ToString() };
+ string [] s = { uniqueID.ToString(), personName, exerciseName, load1RM.ToString(),
date.ToShortDateString() };
return s;
}
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 28cf02b..359fc14 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -703,7 +703,7 @@ public partial class ChronoJumpWindow
void array1RMUpdate (bool returnPersonNameAndExerciseName)
{
array1RM = SqliteEncoder.Select1RM(
- false, currentPerson.UniqueID, currentSession.UniqueID,
+ false, currentPerson.UniqueID, -1, //-1: currentSession = all sessions
getExerciseIDFromCombo(exerciseCombos.CAPTURE),
returnPersonNameAndExerciseName);
}
@@ -720,7 +720,8 @@ public partial class ChronoJumpWindow
"ID",
Catalog.GetString("Person"),
Catalog.GetString("Exercise"),
- Catalog.GetString("Load 1RM")
+ Catalog.GetString("Load 1RM"),
+ Catalog.GetString("Session date")
};
ArrayList bigArray = new ArrayList();
diff --git a/src/sqlite/encoder.cs b/src/sqlite/encoder.cs
index 49ed38e..1fff941 100644
--- a/src/sqlite/encoder.cs
+++ b/src/sqlite/encoder.cs
@@ -877,7 +877,7 @@ class SqliteEncoder : Sqlite
if(! dbconOpened)
Sqlite.Close();
}
-
+
public static ArrayList Select1RM (bool dbconOpened, int personID, int sessionID, int exerciseID,
bool returnPersonNameAndExerciseName)
{
if(! dbconOpened)
@@ -912,12 +912,13 @@ class SqliteEncoder : Sqlite
}
if(returnPersonNameAndExerciseName)
- dbcmd.CommandText = "SELECT " + Constants.Encoder1RMTable + ".*, person77.name,
encoderExercise.name" +
- " FROM " + Constants.Encoder1RMTable + ", person77, encoderExercise " +
- whereStr +
+ dbcmd.CommandText = "SELECT " + Constants.Encoder1RMTable + ".*, person77.name,
encoderExercise.name, session.date" +
+ " FROM " + Constants.Encoder1RMTable + ", person77, encoderExercise, session
" +
+ whereStr + " AND " + Constants.Encoder1RMTable + ".sessionID =
session.uniqueID " +
" ORDER BY uniqueID DESC"; //this allows to select the last uniqueID because
will be the first in the returned array
else
- dbcmd.CommandText = "SELECT * FROM " + Constants.Encoder1RMTable + whereStr +
+ dbcmd.CommandText = "SELECT " + Constants.Encoder1RMTable + ".*, session.date FROM "
+
+ Constants.Encoder1RMTable + ", session" + whereStr +
" ORDER BY uniqueID DESC"; //this allows to select the last uniqueID because
will be the first in the returned array
LogB.SQL(dbcmd.CommandText.ToString());
@@ -934,6 +935,7 @@ class SqliteEncoder : Sqlite
Convert.ToInt32(reader[0].ToString()), //uniqueID
Convert.ToInt32(reader[1].ToString()), //personID
Convert.ToInt32(reader[2].ToString()), //sessionID
+ UtilDate.FromSql(reader[10].ToString()),//date
Convert.ToInt32(reader[3].ToString()), //exerciseID
Convert.ToDouble(Util.ChangeDecimalSeparator(reader[4].ToString())), //load1RM
reader[8].ToString(), //personName
@@ -944,6 +946,7 @@ class SqliteEncoder : Sqlite
Convert.ToInt32(reader[0].ToString()), //uniqueID
Convert.ToInt32(reader[1].ToString()), //personID
Convert.ToInt32(reader[2].ToString()), //sessionID
+ UtilDate.FromSql(reader[5].ToString()), //date
Convert.ToInt32(reader[3].ToString()), //exerciseID
Convert.ToDouble(Util.ChangeDecimalSeparator(reader[4].ToString())) //load1RM
);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]