From 04d05beb806d5e3d282ee222e3c7000a9fd288ba Mon Sep 17 00:00:00 2001 From: Tzachi Dar Date: Sun, 21 Aug 2016 02:04:22 +0300 Subject: [PATCH] * Take the correct time stamp even when find_new_curve is not called on last packet. --- .../java/com/eveningoutpost/dexdrip/Models/BgReading.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/Models/BgReading.java b/app/src/main/java/com/eveningoutpost/dexdrip/Models/BgReading.java index 83b1ab5582..ebd0feb70a 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/Models/BgReading.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/Models/BgReading.java @@ -928,11 +928,12 @@ public void find_slope() { public void find_new_curve() { List last_3 = BgReading.latest(3); if ((last_3 != null) && (last_3.size() == 3)) { + BgReading latest = last_3.get(0); BgReading second_latest = last_3.get(1); BgReading third_latest = last_3.get(2); - double y3 = calculated_value; - double x3 = timestamp; + double y3 = latest.calculated_value; + double x3 = latest.timestamp; double y2 = second_latest.calculated_value; double x2 = second_latest.timestamp; double y1 = third_latest.calculated_value; @@ -952,7 +953,7 @@ public void find_new_curve() { BgReading second_latest = last_3.get(1); double y2 = latest.calculated_value; - double x2 = timestamp; + double x2 = latest.timestamp; double y1 = second_latest.calculated_value; double x1 = second_latest.timestamp;