[chronojump] Networks encoder download correctly exercises with percent_body_mass_displaced and speed_at_one_rm e
- From: Xavier de Blas <xaviblas src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [chronojump] Networks encoder download correctly exercises with percent_body_mass_displaced and speed_at_one_rm e
- Date: Tue, 8 Mar 2022 17:29:26 +0000 (UTC)
commit 8312c9efe2680fa10a50b38888866e4e672cad42
Author: Xavier de Blas <xaviblas gmail com>
Date: Tue Mar 8 18:28:34 2022 +0100
Networks encoder download correctly exercises with percent_body_mass_displaced and speed_at_one_rm even
if they are null
src/gui/networks.cs | 2 +-
src/json/compujump.cs | 13 +++++++++++--
2 files changed, 12 insertions(+), 3 deletions(-)
---
diff --git a/src/gui/networks.cs b/src/gui/networks.cs
index 81ff85888..0f3977399 100644
--- a/src/gui/networks.cs
+++ b/src/gui/networks.cs
@@ -1012,7 +1012,7 @@ public partial class ChronoJumpWindow
{
SqliteEncoder.InsertExercise(
false, exRemote.uniqueID, exRemote.name,
exRemote.percentBodyWeight,
- "", "", "", type);
+ "", "", Util.ConvertToPoint(exRemote.Speed1RM), type);
updateEncoderExercisesGui(exRemote.name);
}
}
diff --git a/src/json/compujump.cs b/src/json/compujump.cs
index 4ff3845e9..497d82067 100644
--- a/src/json/compujump.cs
+++ b/src/json/compujump.cs
@@ -376,9 +376,18 @@ public class JsonCompujump : Json
// 3) add exercise to the list
Int32 newExId = jsonSE ["id"];
string newExName = jsonSE ["name"];
- int newExPercentBodyMassDisplaced = jsonSE
["measurable_info"]["percent_body_mass_displaced"];
+
+ int newExPercentBodyMassDisplaced = 0;
+ if(jsonSE ["measurable_info"]["percent_body_mass_displaced"] != null)
+ newExPercentBodyMassDisplaced = jsonSE
["measurable_info"]["percent_body_mass_displaced"];
+
+ double newExSpeedAt1RM = 0;
+ if(jsonSE ["measurable_info"]["speed_at_one_rm"] != null)
+ newExSpeedAt1RM = Convert.ToDouble(Util.ChangeDecimalSeparator(
+ jsonSE
["measurable_info"]["speed_at_one_rm"].ToString() )); //ToString is mandatory
+
ex_list.Add(new EncoderExercise(newExId, newExName, newExPercentBodyMassDisplaced,
- "", "", 0, newExEncoderGi));
+ "", "", newExSpeedAt1RM, newExEncoderGi));
}
return ex_list;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]