fix cob calculation
This commit is contained in:
parent
e2f28e0ae4
commit
28430cc757
|
@ -417,6 +417,7 @@ public class IobCobCalculatorPlugin extends PluginBase {
|
|||
if (autosensData != null) {
|
||||
displayCob = autosensData.cob;
|
||||
for (Treatment treatment : treatments) {
|
||||
if (!treatment.isValid) continue;
|
||||
if (IobCobCalculatorPlugin.roundUpTime(treatment.date) > IobCobCalculatorPlugin.roundUpTime(autosensData.time)
|
||||
&& treatment.date <= now && treatment.carbs > 0) {
|
||||
displayCob += treatment.carbs;
|
||||
|
@ -424,6 +425,7 @@ public class IobCobCalculatorPlugin extends PluginBase {
|
|||
}
|
||||
}
|
||||
for (Treatment treatment : treatments) {
|
||||
if (!treatment.isValid) continue;
|
||||
if (treatment.date > now && treatment.carbs > 0) {
|
||||
futureCarbs += treatment.carbs;
|
||||
}
|
||||
|
|
|
@ -284,6 +284,8 @@ public class TreatmentsPlugin extends PluginBase implements TreatmentsInterface
|
|||
long last = 0;
|
||||
synchronized (treatments) {
|
||||
for (Treatment t : treatments) {
|
||||
if (!t.isValid)
|
||||
continue;
|
||||
if (t.date > last && t.insulin > 0 && t.isValid && t.date <= now)
|
||||
last = t.date;
|
||||
}
|
||||
|
|
|
@ -465,7 +465,7 @@ public class WatchUpdaterService extends WearableListenerService implements
|
|||
|
||||
List<Treatment> treatments = TreatmentsPlugin.getPlugin().getTreatmentsFromHistory();
|
||||
for (Treatment treatment : treatments) {
|
||||
if (treatment.date > startTimeWindow) {
|
||||
if (treatment.isValid && treatment.date > startTimeWindow) {
|
||||
boluses.add(treatmentMap(treatment.date, treatment.insulin, treatment.carbs, treatment.isSMB, treatment.isValid));
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue