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> getTreatments5MinBackFromHistory(long time);
long getLastSMBTime();
long getLastBolusTime();
// real basals (not faked by extended bolus)
boolean isInHistoryRealTempBasalInProgress();

View file

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

View file

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