mirror of
https://github.com/oliexdev/openScale.git
synced 2025-08-23 16:53:04 +02:00
fix bug in weight evaluation sheet that the limit units are not correctly converted to the user scale unit.
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
package com.health.openscale.core.evaluation;
|
||||
|
||||
import com.health.openscale.core.datatypes.ScaleUser;
|
||||
import com.health.openscale.core.utils.Converters;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
@@ -179,11 +180,11 @@ public class EvaluationSheet {
|
||||
}
|
||||
|
||||
if (weight < lowLimit) { // low
|
||||
return new EvaluationResult(weight, Math.round(lowLimit), Math.round(highLimit), EvaluationResult.EVAL_STATE.LOW);
|
||||
return new EvaluationResult(weight, Converters.fromKilogram(Math.round(lowLimit), evalUser.getScaleUnit()), Converters.fromKilogram(Math.round(highLimit), evalUser.getScaleUnit()), EvaluationResult.EVAL_STATE.LOW);
|
||||
} else if (weight >= lowLimit && weight <= highLimit) { // normal
|
||||
return new EvaluationResult(weight, Math.round(lowLimit), Math.round(highLimit), EvaluationResult.EVAL_STATE.NORMAL);
|
||||
return new EvaluationResult(weight, Converters.fromKilogram(Math.round(lowLimit), evalUser.getScaleUnit()), Converters.fromKilogram(Math.round(highLimit), evalUser.getScaleUnit()), EvaluationResult.EVAL_STATE.NORMAL);
|
||||
} else if (weight > highLimit) { //high
|
||||
return new EvaluationResult(weight, Math.round(lowLimit), Math.round(highLimit), EvaluationResult.EVAL_STATE.HIGH);
|
||||
return new EvaluationResult(weight, Converters.fromKilogram(Math.round(lowLimit), evalUser.getScaleUnit()), Converters.fromKilogram(Math.round(highLimit), evalUser.getScaleUnit()), EvaluationResult.EVAL_STATE.HIGH);
|
||||
}
|
||||
|
||||
return new EvaluationResult(0, -1, -1, EvaluationResult.EVAL_STATE.UNDEFINED);
|
||||
|
@@ -21,9 +21,9 @@ import android.support.v4.content.ContextCompat;
|
||||
|
||||
import com.health.openscale.R;
|
||||
import com.health.openscale.core.datatypes.ScaleMeasurement;
|
||||
import com.health.openscale.core.datatypes.ScaleUser;
|
||||
import com.health.openscale.core.evaluation.EvaluationResult;
|
||||
import com.health.openscale.core.evaluation.EvaluationSheet;
|
||||
import com.health.openscale.core.utils.Converters;
|
||||
|
||||
public class WeightMeasurementView extends FloatMeasurementView {
|
||||
|
||||
@@ -53,7 +53,7 @@ public class WeightMeasurementView extends FloatMeasurementView {
|
||||
|
||||
@Override
|
||||
protected float getMaxValue() {
|
||||
return 300;
|
||||
return Converters.fromKilogram(300.0f, getScaleUser().getScaleUnit());
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Reference in New Issue
Block a user