getLastSBMTime -> getLastBolusTime

This commit is contained in:
Milos Kozak 2017-10-26 22:12:15 +02:00
parent dfd657ce2d
commit b5f843d901
3 changed files with 9 additions and 7 deletions

View file

@ -30,7 +30,7 @@ public interface TreatmentsInterface {
List<Treatment> getTreatmentsFromHistory(); List<Treatment> getTreatmentsFromHistory();
List<Treatment> getTreatments5MinBackFromHistory(long time); List<Treatment> getTreatments5MinBackFromHistory(long time);
long getLastSMBTime(); long getLastBolusTime();
// real basals (not faked by extended bolus) // real basals (not faked by extended bolus)
boolean isInHistoryRealTempBasalInProgress(); boolean isInHistoryRealTempBasalInProgress();

View file

@ -594,7 +594,7 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
} }
if (request.smb != 0) { if (request.smb != 0) {
long lastSMBTime = getLastSMBTime(); long lastSMBTime = getLastBolusTime();
if (lastSMBTime != 0 && lastSMBTime + 4.5 * 60 * 1000 > System.currentTimeMillis()) { if (lastSMBTime != 0 && lastSMBTime + 4.5 * 60 * 1000 > System.currentTimeMillis()) {
log.debug("SMB requsted but still in 5 min interval"); log.debug("SMB requsted but still in 5 min interval");
} else { } else {
@ -820,8 +820,8 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
} }
@Override @Override
public long getLastSMBTime() { public long getLastBolusTime() {
return activeTreatments.getLastSMBTime(); return activeTreatments.getLastBolusTime();
} }
@Override @Override

View file

@ -8,6 +8,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Date;
import java.util.List; import java.util.List;
import info.nightscout.androidaps.Config; import info.nightscout.androidaps.Config;
@ -256,7 +257,7 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
result.mealCOB = autosensData.cob; result.mealCOB = autosensData.cob;
result.minDeviationSlope = autosensData.minDeviationSlope; result.minDeviationSlope = autosensData.minDeviationSlope;
} }
result.lastBolusTime = getLastSMBTime(); result.lastBolusTime = getLastBolusTime();
return result; return result;
} }
@ -279,15 +280,16 @@ public class TreatmentsPlugin implements PluginBase, TreatmentsInterface {
} }
@Override @Override
public long getLastSMBTime() { public long getLastBolusTime() {
long last = 0; long last = 0;
for (Integer pos = 0; pos < treatments.size(); pos++) { for (Integer pos = 0; pos < treatments.size(); pos++) {
Treatment t = treatments.get(pos); Treatment t = treatments.get(pos);
if (!t.isValid) if (!t.isValid)
continue; continue;
if (t.isSMB && t.date > last) if (t.date > last)
last = t.date; last = t.date;
} }
log.debug("Last bolus time: " + new Date(last).toLocaleString());
return last; return last;
} }