From b5f843d901080dd148ae2ad3089a2ccb87891a0d Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Thu, 26 Oct 2017 22:12:15 +0200 Subject: [PATCH] getLastSBMTime -> getLastBolusTime --- .../androidaps/interfaces/TreatmentsInterface.java | 2 +- .../plugins/ConfigBuilder/ConfigBuilderPlugin.java | 6 +++--- .../androidaps/plugins/Treatments/TreatmentsPlugin.java | 8 +++++--- 3 files changed, 9 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/interfaces/TreatmentsInterface.java b/app/src/main/java/info/nightscout/androidaps/interfaces/TreatmentsInterface.java index 2eae150cda..134b419240 100644 --- a/app/src/main/java/info/nightscout/androidaps/interfaces/TreatmentsInterface.java +++ b/app/src/main/java/info/nightscout/androidaps/interfaces/TreatmentsInterface.java @@ -30,7 +30,7 @@ public interface TreatmentsInterface { List getTreatmentsFromHistory(); List getTreatments5MinBackFromHistory(long time); - long getLastSMBTime(); + long getLastBolusTime(); // real basals (not faked by extended bolus) boolean isInHistoryRealTempBasalInProgress(); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java index fe0145a15f..8be6a5475c 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/ConfigBuilder/ConfigBuilderPlugin.java @@ -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 diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsPlugin.java index 8a14bd5645..441f6eec88 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsPlugin.java @@ -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; }