allow old data on the wf
This commit is contained in:
parent
41fb92815b
commit
c3d14b506d
2 changed files with 10 additions and 3 deletions
|
@ -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<BgReading> 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;
|
||||
}
|
||||
|
||||
|
|
|
@ -316,7 +316,7 @@ public class WatchUpdaterService extends WearableListenerService implements
|
|||
if (last_bg == null) return;
|
||||
|
||||
List<BgReading> 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);
|
||||
|
|
Loading…
Reference in a new issue