From c3d14b506d9c0ea042a8daeed6718605d0309f83 Mon Sep 17 00:00:00 2001 From: AdrianLxM Date: Thu, 4 Jan 2018 16:20:49 +0100 Subject: [PATCH] allow old data on the wf --- .../nightscout/androidaps/data/GlucoseStatus.java | 11 +++++++++-- .../Wear/wearintegration/WatchUpdaterService.java | 2 +- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/data/GlucoseStatus.java b/app/src/main/java/info/nightscout/androidaps/data/GlucoseStatus.java index 1623028a82..ad4f161799 100644 --- a/app/src/main/java/info/nightscout/androidaps/data/GlucoseStatus.java +++ b/app/src/main/java/info/nightscout/androidaps/data/GlucoseStatus.java @@ -64,14 +64,21 @@ public class GlucoseStatus { return this; } + + @Nullable - public static GlucoseStatus getGlucoseStatusData() { + public static GlucoseStatus getGlucoseStatusData(){ + return getGlucoseStatusData(false); + } + + @Nullable + public static GlucoseStatus getGlucoseStatusData(boolean allowOldData) { // load 45min long fromtime = (long) (System.currentTimeMillis() - 60 * 1000L * 45); List data = MainApp.getDbHelper().getBgreadingsDataFromTime(fromtime, false); int sizeRecords = data.size(); - if (sizeRecords < 1 || data.get(0).date < System.currentTimeMillis() - 7 * 60 * 1000L) { + if (sizeRecords < 1 || (data.get(0).date < System.currentTimeMillis() - 7 * 60 * 1000L && !allowOldData)) { return null; } diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/wearintegration/WatchUpdaterService.java b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/wearintegration/WatchUpdaterService.java index 91045ba4d6..6ea01692fe 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/wearintegration/WatchUpdaterService.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/wearintegration/WatchUpdaterService.java @@ -316,7 +316,7 @@ public class WatchUpdaterService extends WearableListenerService implements if (last_bg == null) return; List graph_bgs = MainApp.getDbHelper().getBgreadingsDataFromTime(startTime, true); - GlucoseStatus glucoseStatus = GlucoseStatus.getGlucoseStatusData(); + GlucoseStatus glucoseStatus = GlucoseStatus.getGlucoseStatusData(true); if (!graph_bgs.isEmpty()) { DataMap entries = dataMapSingleBG(last_bg, glucoseStatus);