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
1 changed files with 3 additions and 4 deletions
|
@ -320,14 +320,13 @@ public class GraphData {
|
|||
}
|
||||
|
||||
private double getNearestBg(long date) {
|
||||
double bg = 0;
|
||||
for (int r = bgReadingsArray.size() - 1; r >= 0; r--) {
|
||||
BgReading reading = bgReadingsArray.get(r);
|
||||
if (reading.date > date) continue;
|
||||
bg = Profile.fromMgdlToUnits(reading.value, units);
|
||||
break;
|
||||
return Profile.fromMgdlToUnits(reading.value, units);
|
||||
}
|
||||
return bg;
|
||||
return bgReadingsArray.size() > 0
|
||||
? Profile.fromMgdlToUnits(bgReadingsArray.get(0).value, units) : 0;
|
||||
}
|
||||
|
||||
// scale in % of vertical size (like 0.3)
|
||||
|
|
Loading…
Reference in a new issue