Merge pull request #1015 from jotomo/lemming-treatment
Fix finding BG in graph for treatments before the first displayed BG.
This commit is contained in:
commit
cdc8e45f32
|
@ -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