[chronojump] Encoder historical maxPower checks also laterality
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Encoder historical maxPower checks also laterality
- Date: Fri, 7 Feb 2020 14:46:49 +0000 (UTC)
commit 450257ff33a4a22ba69c83ee1158ec6d74aef79b
Author: Xavier de Blas <xaviblas gmail com>
Date: Fri Feb 7 15:45:47 2020 +0100
Encoder historical maxPower checks also laterality
src/gui/app1/encoder.cs | 73 ++++++++++++++++++++-----------------
src/gui/encoderSelectRepetitions.cs | 6 +--
src/sqlite/encoder.cs | 10 +++--
src/sqlite/main.cs | 4 +-
src/sqlite/personSession.cs | 4 +-
src/sqlite/session.cs | 4 +-
6 files changed, 56 insertions(+), 45 deletions(-)
---
diff --git a/src/gui/app1/encoder.cs b/src/gui/app1/encoder.cs
index 10be3414..6f654ec3 100644
--- a/src/gui/app1/encoder.cs
+++ b/src/gui/app1/encoder.cs
@@ -658,7 +658,8 @@ public partial class ChronoJumpWindow
//finding historical maxPower of a person in an exercise
Constants.EncoderGI encGI = getEncoderGI();
ArrayList arrayTemp = SqliteEncoder.Select(false, -1, currentPerson.UniqueID, -1, encGI,
- getExerciseIDFromEncoderCombo(exerciseCombos.CAPTURE), "curve",
EncoderSQL.Eccons.ALL,
+ getExerciseIDFromEncoderCombo(exerciseCombos.CAPTURE), "curve",
+ EncoderSQL.Eccons.ALL, getLateralityFromGui(true),
false, false);
double maxPower = 0;
if(encGI == Constants.EncoderGI.GRAVITATORY)
@@ -849,11 +850,7 @@ public partial class ChronoJumpWindow
SqlitePreferences.Update (SqlitePreferences.EncoderContractionInertial, eccon, true);
//3 laterality
- string laterality = "RL";
- if(radio_encoder_laterality_r.Active)
- laterality = "R";
- else if(radio_encoder_laterality_l.Active)
- laterality = "L";
+ string laterality = getLateralityFromGui(true);
if(currentEncoderGI == Constants.EncoderGI.GRAVITATORY)
SqlitePreferences.Update (SqlitePreferences.EncoderLateralityGravitatory, laterality,
true);
@@ -1344,11 +1341,7 @@ public partial class ChronoJumpWindow
videoURL = file;
}
- string laterality = Catalog.GetString("RL");
- if(radio_encoder_laterality_r.Active)
- laterality = Catalog.GetString("R");
- else if(radio_encoder_laterality_l.Active)
- laterality = Catalog.GetString("L");
+ string laterality = getLateralityFromGui(false);
//see explanation on the top of this file
lastEncoderSQLSignal = new EncoderSQL(
@@ -1522,7 +1515,7 @@ public partial class ChronoJumpWindow
EncoderSQL eSQL = new EncoderSQL();
try {
eSQL = (EncoderSQL) SqliteEncoder.Select(dbconOpened, uniqueID, 0, 0,
Constants.EncoderGI.ALL,
- -1, "", EncoderSQL.Eccons.ALL, false, true)[0];
+ -1, "", EncoderSQL.Eccons.ALL, "", false, true)[0];
} catch {
eSQLfound = false;
LogB.Warning("Catched! seems it's already deleted");
@@ -1560,7 +1553,7 @@ public partial class ChronoJumpWindow
ArrayList encoderLoadSignalData() {
return SqliteEncoder.Select(
false, -1, currentPerson.UniqueID, currentSession.UniqueID, getEncoderGI(),
- -1, "signal", EncoderSQL.Eccons.ALL,
+ -1, "signal", EncoderSQL.Eccons.ALL, "",
false, true);
}
//this is called when user clicks on load signal
@@ -1646,18 +1639,11 @@ public partial class ChronoJumpWindow
int uniqueID = genericWin.TreeviewSelectedRowID();
- /*
- * maxPowerIntersession it's defined (Sqlite select) on capture and after capture
- * if we have not captured yet, just Sqlite select now
- */
- if(! repetitiveConditionsWin.EncoderRelativeToSet)
- maxPowerIntersession = findMaxPowerIntersession();
-
genericWin.HideAndNull();
ArrayList data = SqliteEncoder.Select(
false, uniqueID, currentPerson.UniqueID, currentSession.UniqueID,
Constants.EncoderGI.ALL,
- -1, "signal", EncoderSQL.Eccons.ALL,
+ -1, "signal", EncoderSQL.Eccons.ALL, "",
false, true);
bool success = false;
@@ -1681,6 +1667,13 @@ public partial class ChronoJumpWindow
else //if(eSQL.laterality == Catalog.GetString("L"))
radio_encoder_laterality_l.Active = true;
+ /*
+ * maxPowerIntersession it's defined (Sqlite select) on capture and after
capture
+ * if we have not captured yet, just Sqlite select now
+ */
+ if(! repetitiveConditionsWin.EncoderRelativeToSet)
+ maxPowerIntersession = findMaxPowerIntersession();
+
spin_encoder_extra_weight.Value =
Convert.ToDouble(Util.ChangeDecimalSeparator(eSQL.extraWeight));
preferences.EncoderChangeMinHeight(eSQL.encoderConfiguration.has_inertia,
eSQL.minHeight);
@@ -1777,7 +1770,7 @@ public partial class ChronoJumpWindow
//1) select set
int setID = genericWin.TreeviewSelectedUniqueID;
EncoderSQL eSQL_set = (EncoderSQL) SqliteEncoder.Select(true, setID, 0, 0,
Constants.EncoderGI.ALL,
- -1, "", EncoderSQL.Eccons.ALL, false, true)[0];
+ -1, "", EncoderSQL.Eccons.ALL, "", false, true)[0];
//2) if changed comment, update SQL, and update treeview
//first remove conflictive characters
@@ -1811,7 +1804,7 @@ public partial class ChronoJumpWindow
foreach (EncoderSignalCurve esc in linkedReps)
{
EncoderSQL eSQL = (EncoderSQL) SqliteEncoder.Select(true, esc.curveID, 0, 0,
Constants.EncoderGI.ALL,
- -1, "curve", EncoderSQL.Eccons.ALL, false, true)[0];
+ -1, "curve", EncoderSQL.Eccons.ALL, "", false, true)[0];
eSQLChangedPerson = eSQL.ChangePerson(idName);
SqliteEncoder.Update(true, eSQLChangedPerson);
@@ -1849,7 +1842,7 @@ public partial class ChronoJumpWindow
else {
EncoderSQL eSQL = (EncoderSQL) SqliteEncoder.Select(
false, signalID, 0, 0, Constants.EncoderGI.ALL,
- -1, "signal", EncoderSQL.Eccons.ALL, false, true)[0];
+ -1, "signal", EncoderSQL.Eccons.ALL, "", false, true)[0];
//delete signal and related curves (both from SQL and files)
encoderSignalDelete(eSQL.GetFullURL(false), signalID); //don't convertPathToR
@@ -1912,7 +1905,7 @@ public partial class ChronoJumpWindow
//select related curves to find URL
ArrayList array = SqliteEncoder.Select(
false, esc.curveID, -1, -1, Constants.EncoderGI.ALL,
- -1, "curve", EncoderSQL.Eccons.ALL, false, true);
+ -1, "curve", EncoderSQL.Eccons.ALL, "", false, true);
if (array != null && array.Count > 0)
{
@@ -2287,7 +2280,7 @@ public partial class ChronoJumpWindow
{
EncoderSQL eSQL = (EncoderSQL) SqliteEncoder.Select(
false, Convert.ToInt32(encoderSignalUniqueID), 0, 0, Constants.EncoderGI.ALL,
- -1, "signal", EncoderSQL.Eccons.ALL, false, true)[0];
+ -1, "signal", EncoderSQL.Eccons.ALL, "", false, true)[0];
//delete signal and related curves (both from SQL and files)
encoderSignalDelete(eSQL.GetFullURL(false), Convert.ToInt32(encoderSignalUniqueID));
@@ -2398,7 +2391,7 @@ public partial class ChronoJumpWindow
ArrayList data = SqliteEncoder.Select(
dbconOpened, -1, currentPerson.UniqueID, currentSession.UniqueID,
getEncoderGI(),
getExerciseIDFromEncoderCombo(exerciseCombos.ANALYZE),
- "curve", EncoderSQL.Eccons.ALL,
+ "curve", EncoderSQL.Eccons.ALL, "",
false, true);
updateComboEncoderAnalyzeCurveNumSavedReps(data);
} //interperson and intersession modes don't use combo_encoder_analyze_curve_num_combo
@@ -2636,7 +2629,7 @@ public partial class ChronoJumpWindow
//if current session and no data of this person and session, return
ArrayList data = SqliteEncoder.Select(
false, -1, currentPerson.UniqueID, currentSession.UniqueID,
getEncoderGI(),
- getExerciseIDFromEncoderCombo(exerciseCombos.ANALYZE), "curve",
EncoderSQL.Eccons.ALL,
+ getExerciseIDFromEncoderCombo(exerciseCombos.ANALYZE), "curve",
EncoderSQL.Eccons.ALL, "",
false, true);
if(data.Count == 0) {
@@ -2978,7 +2971,7 @@ public partial class ChronoJumpWindow
data = SqliteEncoder.Select(
false, -1, currentPerson.UniqueID, currentSession.UniqueID,
getEncoderGI(),
getExerciseIDFromEncoderCombo(exerciseCombos.ANALYZE),
- "curve", ecconSelect,
+ "curve", ecconSelect, "",
false, true);
}
else if(radio_encoder_analyze_groupal_current_session.Active)
@@ -2990,7 +2983,7 @@ public partial class ChronoJumpWindow
currentSession.UniqueID,
getEncoderGI(),
getExerciseIDFromEncoderCombo(exerciseCombos.ANALYZE),
- "curve", EncoderSQL.Eccons.ALL,
+ "curve", EncoderSQL.Eccons.ALL, "",
false, //onlyActive=false. Means: all saved
repetitions
true);
foreach(EncoderSQL eSQL in dataPre) {
@@ -3010,7 +3003,7 @@ public partial class ChronoJumpWindow
Util.FetchID(encSelReps.EncoderCompareInter[i].ToString()),
getEncoderGI(),
getExerciseIDFromEncoderCombo(exerciseCombos.ANALYZE),
- "curve", EncoderSQL.Eccons.ALL,
+ "curve", EncoderSQL.Eccons.ALL, "",
false, //onlyActive=false. Means: all saved
repetitions
true);
foreach(EncoderSQL eSQL in dataPre) {
@@ -4271,6 +4264,20 @@ public partial class ChronoJumpWindow
image_top_laterality.Pixbuf = pixbuf;
}
+ private string getLateralityFromGui (bool english)
+ {
+ string laterality = "RL";
+ if(radio_encoder_laterality_r.Active)
+ laterality = "R";
+ else if(radio_encoder_laterality_l.Active)
+ laterality = "L";
+
+ if(! english)
+ laterality = Catalog.GetString(laterality);
+
+ LogB.Information("Laterality: " + laterality);
+ return laterality;
+ }
// ---- start of combo_encoder_capture_curves_save stuff ----
@@ -6994,7 +7001,7 @@ public partial class ChronoJumpWindow
ArrayList array = SqliteEncoder.Select(
true, Convert.ToInt32(encoderSignalUniqueID), 0, 0, getEncoderGI(),
- -1, "", EncoderSQL.Eccons.ALL,
+ -1, "", EncoderSQL.Eccons.ALL, "",
false, true);
if(array.Count == 0)
@@ -7004,7 +7011,7 @@ public partial class ChronoJumpWindow
ArrayList data = SqliteEncoder.Select(
true, -1, currentPerson.UniqueID, currentSession.UniqueID, getEncoderGI(),
- -1, "curve", EncoderSQL.Eccons.ALL,
+ -1, "curve", EncoderSQL.Eccons.ALL, "",
false, true);
bool deletedUserCurves = false;
diff --git a/src/gui/encoderSelectRepetitions.cs b/src/gui/encoderSelectRepetitions.cs
index e8877e96..23b51417 100644
--- a/src/gui/encoderSelectRepetitions.cs
+++ b/src/gui/encoderSelectRepetitions.cs
@@ -189,7 +189,7 @@ public class EncoderSelectRepetitionsIndividualCurrentSession : EncoderSelectRep
{
data = SqliteEncoder.Select(
false, -1, currentPerson.UniqueID, currentSession.UniqueID, encoderGI,
- exerciseID, "curve", EncoderSQL.Eccons.ALL,
+ exerciseID, "curve", EncoderSQL.Eccons.ALL, "",
false, true);
}
@@ -318,7 +318,7 @@ public class EncoderSelectRepetitionsIndividualCurrentSession : EncoderSelectRep
ArrayList data = SqliteEncoder.Select(
false, -1, currentPerson.UniqueID, currentSession.UniqueID, encoderGI,
- exerciseID, "curve", EncoderSQL.Eccons.ALL,
+ exerciseID, "curve", EncoderSQL.Eccons.ALL, "",
false, true);
//update on database the curves that have been selected/deselected
@@ -590,7 +590,7 @@ public class EncoderSelectRepetitionsGroupalCurrentSession : EncoderSelectRepeti
foreach(Person p in dataPre) {
ArrayList eSQLarray = SqliteEncoder.Select(
false, -1, p.UniqueID, currentSession.UniqueID, encoderGI,
- exerciseID, "curve", EncoderSQL.Eccons.ALL,
+ exerciseID, "curve", EncoderSQL.Eccons.ALL, "",
false, true);
int allCurves = eSQLarray.Count;
diff --git a/src/sqlite/encoder.cs b/src/sqlite/encoder.cs
index 90c158b8..616a9d6a 100644
--- a/src/sqlite/encoder.cs
+++ b/src/sqlite/encoder.cs
@@ -208,7 +208,7 @@ class SqliteEncoder : Sqlite
// (to delete them if they are old copies)
public static ArrayList Select (
bool dbconOpened, int uniqueID, int personID, int sessionID, Constants.EncoderGI
encoderGI,
- int exerciseID, string signalOrCurve, EncoderSQL.Eccons ecconSelect,
+ int exerciseID, string signalOrCurve, EncoderSQL.Eccons ecconSelect, string
lateralityEnglish,
bool onlyActive, bool orderIDascendent)
{
if(! dbconOpened)
@@ -226,14 +226,18 @@ class SqliteEncoder : Sqlite
if(exerciseID != -1)
exerciseIDStr = " exerciseID = " + exerciseID + " AND ";
+ string lateralityEnglishStr = "";
+ if(lateralityEnglish != "")
+ lateralityEnglishStr = " laterality = \"" + lateralityEnglish + "\" AND ";
+
string selectStr = "";
if(uniqueID != -1)
selectStr = Constants.EncoderTable + ".uniqueID = " + uniqueID;
else {
if(signalOrCurve == "all")
- selectStr = personIDStr + sessionIDStr + exerciseIDStr;
+ selectStr = personIDStr + sessionIDStr + exerciseIDStr + lateralityEnglishStr;
else
- selectStr = personIDStr + sessionIDStr + exerciseIDStr + " signalOrCurve =
\"" + signalOrCurve + "\"";
+ selectStr = personIDStr + sessionIDStr + exerciseIDStr + lateralityEnglishStr
+ " signalOrCurve = \"" + signalOrCurve + "\"";
if(ecconSelect != EncoderSQL.Eccons.ALL)
selectStr += " AND " + Constants.EncoderTable + ".eccon = \"" +
EncoderSQL.Eccons.ecS.ToString() + "\"";
diff --git a/src/sqlite/main.cs b/src/sqlite/main.cs
index 0b8e85c5..2c4cd6e1 100644
--- a/src/sqlite/main.cs
+++ b/src/sqlite/main.cs
@@ -1638,9 +1638,9 @@ class Sqlite
SqliteEncoder.createTableEncoderSignalCurve();
ArrayList signals = SqliteEncoder.Select(true, -1, -1, -1,
Constants.EncoderGI.ALL,
- -1, "signal", EncoderSQL.Eccons.ALL, false, false);
+ -1, "signal", EncoderSQL.Eccons.ALL, "", false, false);
ArrayList curves = SqliteEncoder.Select(true, -1, -1, -1,
Constants.EncoderGI.ALL,
- -1, "curve", EncoderSQL.Eccons.ALL, false, false);
+ -1, "curve", EncoderSQL.Eccons.ALL, "", false, false);
int signalID;
conversionRateTotal = signals.Count;
conversionRate = 1;
diff --git a/src/sqlite/personSession.cs b/src/sqlite/personSession.cs
index 2a57afc6..f6b4d56f 100644
--- a/src/sqlite/personSession.cs
+++ b/src/sqlite/personSession.cs
@@ -437,7 +437,7 @@ class SqlitePersonSession : Sqlite
//delete encoder signal and curves (and it's videos)
ArrayList encoderArray = SqliteEncoder.Select(
true, -1, Convert.ToInt32(personID), Convert.ToInt32(sessionID),
Constants.EncoderGI.ALL,
- -1, "signal", EncoderSQL.Eccons.ALL,
+ -1, "signal", EncoderSQL.Eccons.ALL, "",
false, true);
foreach(EncoderSQL eSQL in encoderArray) {
@@ -449,7 +449,7 @@ class SqlitePersonSession : Sqlite
encoderArray = SqliteEncoder.Select(
true, -1, Convert.ToInt32(personID), Convert.ToInt32(sessionID),
Constants.EncoderGI.ALL,
- -1, "curve", EncoderSQL.Eccons.ALL,
+ -1, "curve", EncoderSQL.Eccons.ALL, "",
false, true);
foreach(EncoderSQL eSQL in encoderArray) {
diff --git a/src/sqlite/session.cs b/src/sqlite/session.cs
index 70de38c6..daf93be7 100644
--- a/src/sqlite/session.cs
+++ b/src/sqlite/session.cs
@@ -911,7 +911,7 @@ class SqliteSession : Sqlite
//signals
ArrayList encoderArray = SqliteEncoder.Select(
true, -1, -1, Convert.ToInt32(uniqueID), Constants.EncoderGI.ALL,
- -1, "signal", EncoderSQL.Eccons.ALL,
+ -1, "signal", EncoderSQL.Eccons.ALL, "",
false, true);
foreach(EncoderSQL eSQL in encoderArray) {
@@ -924,7 +924,7 @@ class SqliteSession : Sqlite
//curves
encoderArray = SqliteEncoder.Select(
true, -1, -1, Convert.ToInt32(uniqueID), Constants.EncoderGI.ALL,
- -1, "curve", EncoderSQL.Eccons.ALL,
+ -1, "curve", EncoderSQL.Eccons.ALL, "",
false, true);
foreach(EncoderSQL eSQL in encoderArray) {
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]