wear only print valid boluses

This commit is contained in:
AdrianLxM 2018-02-24 18:10:59 +01:00
parent 6d3048a9b1
commit 436e03aa03
4 changed files with 8 additions and 5 deletions

View file

@ -459,7 +459,7 @@ public class WatchUpdaterService extends WearableListenerService implements
List<Treatment> treatments = MainApp.getConfigBuilder().getTreatmentsFromHistory();
for (Treatment treatment:treatments) {
if(treatment.date > startTimeWindow){
boluses.add(treatmentMap(treatment.date, treatment.insulin, treatment.carbs, treatment.isSMB));
boluses.add(treatmentMap(treatment.date, treatment.insulin, treatment.carbs, treatment.isSMB, treatment.isValid));
}
}
@ -503,12 +503,13 @@ public class WatchUpdaterService extends WearableListenerService implements
return dm;
}
private DataMap treatmentMap(long date, double bolus, double carbs, boolean isSMB) {
private DataMap treatmentMap(long date, double bolus, double carbs, boolean isSMB, boolean isValid) {
DataMap dm = new DataMap();
dm.putLong("date", date);
dm.putDouble("bolus", bolus);
dm.putDouble("carbs", carbs);
dm.putBoolean("isSMB", isSMB);
dm.putBoolean("isValid", isValid);
return dm;
}

View file

@ -9,4 +9,5 @@ public class BolusWatchData {
public double bolus;
public double carbs;
public boolean isSMB;
public boolean isValid;
}

View file

@ -412,6 +412,7 @@ public class BIGChart extends WatchFace implements SharedPreferences.OnSharedPre
bwd.bolus = bolus.getDouble("bolus");
bwd.carbs = bolus.getDouble("carbs");
bwd.isSMB = bolus.getBoolean("isSMB");
bwd.isValid = bolus.getBoolean("isValid");
bolusWatchDataList.add(bwd);
}
}

View file

@ -206,14 +206,14 @@ public class BgGraphBuilder {
List<PointValue> pointValues = new ArrayList<PointValue>();
for (BolusWatchData bwd: bolusWatchDataList) {
if(bwd.date > start_time && !bwd.isSMB) {
if(bwd.date > start_time && !bwd.isSMB && !bwd.isValid && bwd.bolus > 0) {
pointValues.add(new PointValue(fuzz(bwd.date), (float) offset-2));
}
}
Line line = new Line(pointValues);
line.setColor(bolusColor);
line.setHasLines(false);
line.setPointRadius(pointSize);
line.setPointRadius(pointSize*2);
line.setHasPoints(true);
return line;
}
@ -223,7 +223,7 @@ public class BgGraphBuilder {
List<PointValue> pointValues = new ArrayList<PointValue>();
for (BolusWatchData bwd: bolusWatchDataList) {
if(bwd.date > start_time && bwd.isSMB) {
if(bwd.date > start_time && bwd.isSMB && !bwd.isValid && bwd.bolus > 0) {
pointValues.add(new PointValue(fuzz(bwd.date), (float) offset-2));
}
}