Fix target line performance regression.
This commit is contained in:
parent
409acd0721
commit
9af0bc2976
1 changed files with 8 additions and 8 deletions
|
@ -243,7 +243,7 @@ public class GraphData {
|
|||
targetsScale.setMultiplier(1);
|
||||
|
||||
List<DataPoint> targetsSeriesArray = new ArrayList<>();
|
||||
double lastTarget = 0;
|
||||
double lastTarget = -1;
|
||||
|
||||
if (LoopPlugin.lastRun != null && LoopPlugin.lastRun.constraintsProcessed != null) {
|
||||
APSResult apsResult = LoopPlugin.lastRun.constraintsProcessed;
|
||||
|
@ -253,22 +253,22 @@ public class GraphData {
|
|||
}
|
||||
}
|
||||
|
||||
for (long time = fromTime; time < toTime; time += 60 * 1000L) {
|
||||
for (long time = fromTime; time < toTime; time += 5 * 60 * 1000L) {
|
||||
TempTarget tt = TreatmentsPlugin.getPlugin().getTempTargetFromHistory(time);
|
||||
double value;
|
||||
if (tt == null) {
|
||||
value = (profile.getTargetLow(time) + profile.getTargetHigh(time)) / 2;
|
||||
} else {
|
||||
value = tt.target();
|
||||
value = Profile.fromMgdlToUnits(value, profile.getUnits());
|
||||
value = Profile.fromMgdlToUnits(tt.target(), profile.getUnits());
|
||||
}
|
||||
if (lastTarget > 0 && lastTarget != value) {
|
||||
if (lastTarget != value) {
|
||||
if (lastTarget != -1)
|
||||
targetsSeriesArray.add(new DataPoint(time, lastTarget));
|
||||
}
|
||||
lastTarget = value;
|
||||
|
||||
targetsSeriesArray.add(new DataPoint(time, value));
|
||||
}
|
||||
lastTarget = value;
|
||||
}
|
||||
targetsSeriesArray.add(new DataPoint(toTime, lastTarget));
|
||||
|
||||
DataPoint[] targets = new DataPoint[targetsSeriesArray.size()];
|
||||
targets = targetsSeriesArray.toArray(targets);
|
||||
|
|
Loading…
Reference in a new issue