Fix finding BG in graph for treatments before the first displayed BG.
(cherry picked from commit 8bdafe3)
This commit is contained in:
parent
260e259fb0
commit
1e0b7d331a
|
@ -320,14 +320,13 @@ public class GraphData {
|
||||||
}
|
}
|
||||||
|
|
||||||
private double getNearestBg(long date) {
|
private double getNearestBg(long date) {
|
||||||
double bg = 0;
|
|
||||||
for (int r = bgReadingsArray.size() - 1; r >= 0; r--) {
|
for (int r = bgReadingsArray.size() - 1; r >= 0; r--) {
|
||||||
BgReading reading = bgReadingsArray.get(r);
|
BgReading reading = bgReadingsArray.get(r);
|
||||||
if (reading.date > date) continue;
|
if (reading.date > date) continue;
|
||||||
bg = Profile.fromMgdlToUnits(reading.value, units);
|
return Profile.fromMgdlToUnits(reading.value, units);
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return bg;
|
return bgReadingsArray.size() > 0
|
||||||
|
? Profile.fromMgdlToUnits(bgReadingsArray.get(0).value, units) : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// scale in % of vertical size (like 0.3)
|
// scale in % of vertical size (like 0.3)
|
||||||
|
|
Loading…
Reference in a new issue