[chronojump] Encoder loss new code on json compjumpEncoder (NEED TESTS)



commit 004e19af0a94a3001be9e3b2d18e93df875ba4d3
Author: Xavier de Blas <xaviblas gmail com>
Date:   Fri Jan 31 17:34:42 2020 +0100

    Encoder loss new code on json compjumpEncoder (NEED TESTS)

 src/encoder.cs               | 5 ++++-
 src/json/compujumpEncoder.cs | 8 ++++++--
 2 files changed, 10 insertions(+), 3 deletions(-)
---
diff --git a/src/encoder.cs b/src/encoder.cs
index 61ea7d78..e86706c2 100644
--- a/src/encoder.cs
+++ b/src/encoder.cs
@@ -663,10 +663,13 @@ public class EncoderSignal
                        if(variable == Constants.MeanPower)
                                compareTo = curve.MeanPowerD;
 
+                       bool needChangeLowest = false;
                        conValue = compareTo;
                        if(compareTo > highest)
+                       {
                                highest = compareTo;
-                       if(compareTo < lowest)
+                               needChangeLowest = true;        //min rep has to be after max
+                       } if(needChangeLowest || compareTo < lowest)
                                lowest = compareTo;
 
                        //LogB.Information(string.Format("Loss ecc/con (by con) of {0}; i: {1} is: {2}", 
variable, i++,
diff --git a/src/json/compujumpEncoder.cs b/src/json/compujumpEncoder.cs
index 8443801d..0daf98d2 100644
--- a/src/json/compujumpEncoder.cs
+++ b/src/json/compujumpEncoder.cs
@@ -262,10 +262,14 @@ public class UploadEncoderDataObject
                        if(by == byTypes.POWER)
                                compareTo = curve.MeanPowerD;
 
-                       if(compareTo < lowest)
-                               lowest = compareTo;
+                       bool needChangeLowest = false;
                        if(compareTo > highest)
+                       {
                                highest = compareTo;
+                               needChangeLowest = true;        //min rep has to be after max
+                       }
+                       if(needChangeLowest || compareTo < lowest)
+                               lowest = compareTo;
 
                        //LogB.Information(string.Format("Loss (con) of {0}; i: {1} is: {2}", by.ToString(), 
i++, Convert.ToInt32(UtilAll.DivideSafe(100.0 * (highest - lowest), highest))));
                }


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