[chronojump] encoder: 1RM Any exercise checks if speed at 1RM parameter is 0



commit 12e56f6c483f14bcbaf1a8cc91a1e9ad7d1feb4d
Author: Xavier de Blas <xaviblas gmail com>
Date:   Thu Feb 7 14:08:47 2019 +0100

    encoder: 1RM Any exercise checks if speed at 1RM parameter is 0

 src/gui/encoder.cs | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)
---
diff --git a/src/gui/encoder.cs b/src/gui/encoder.cs
index 8e819a45..56239a0c 100644
--- a/src/gui/encoder.cs
+++ b/src/gui/encoder.cs
@@ -2562,11 +2562,12 @@ public partial class ChronoJumpWindow
                        }
 
                        //1RM can be individual current set or individual current session
-                       //cannot do 1RM with different exercises (individual current session)
                        if(encoderSelectedAnalysis == "1RM")
                        {
                                string nameTemp = 
Util.FindOnArray(':',1,0,UtilGtk.ComboGetActive(combo_encoder_analyze_1RM),
                                                encoderAnalyze1RMTranslation);
+
+                               //cannot do 1RM with different exercises (individual current session)
                                if(
                                                nameTemp == "1RM Any exercise" ||
                                                nameTemp == Catalog.GetString("1RM Any exercise") ||
@@ -2595,6 +2596,23 @@ public partial class ChronoJumpWindow
                                                return;
                                        }
                                }
+
+                               //cannot do 1RM Any exercise without the "speed at 1RM" exercise parameter
+                               if(nameTemp == "1RM Any exercise" || nameTemp == Catalog.GetString("1RM Any 
exercise"))
+                               {
+                                       EncoderSQL eSQL = (EncoderSQL) data[0];
+                                       EncoderExercise exTemp = (EncoderExercise) 
SqliteEncoder.SelectEncoderExercises(
+                                               false , eSQL.exerciseID, false)[0];
+
+                                       if(exTemp.speed1RM == 0) {
+                                               new DialogMessage(Constants.MessageTypes.WARNING,
+                                                               string.Format(
+                                                                       Catalog.GetString("Sorry, parameter: 
'speed at 1RM' on exercise: '{0}' cannot be 0 for this analysis."),
+                                                                       eSQL.exerciseName) + "\n" +
+                                                               Catalog.GetString("Please edit exercise 
parameters on capture tab."));
+                                               return;
+                                       }
+                               }
                        }
                } //end individual current session
                
@@ -2666,7 +2684,7 @@ public partial class ChronoJumpWindow
 
                        return;
                }
-       
+
                button_encoder_analyze.Visible = false;
                hbox_encoder_analyze_progress.Visible = true;
                button_encoder_analyze_cancel.Sensitive = true;


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]