From f2baa32e40429d928526bf16f1a6cdef35b28fbc Mon Sep 17 00:00:00 2001 From: ecorman Date: Mon, 31 Oct 2016 13:01:38 +0100 Subject: [PATCH] Basal % rate --- .../androidaps/plugins/Loop/APSResult.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Loop/APSResult.java b/app/src/main/java/info/nightscout/androidaps/plugins/Loop/APSResult.java index 0104a13bb6..58ab564f6e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Loop/APSResult.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Loop/APSResult.java @@ -10,7 +10,7 @@ import org.json.JSONObject; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; -import info.nightscout.androidaps.plugins.VirtualPump.VirtualPumpPlugin; +import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; import info.nightscout.utils.DecimalFormatter; /** @@ -21,15 +21,15 @@ public class APSResult implements Parcelable { public double rate; public int duration; public boolean changeRequested = false; - private static VirtualPumpPlugin virtualPumpPlugin = new VirtualPumpPlugin(); //ECOR % basal rate @Override public String toString() { + final ConfigBuilderPlugin configBuilder = MainApp.getConfigBuilder(); if (changeRequested) { if (rate == 0 && duration == 0) return MainApp.sResources.getString(R.string.canceltemp); else - return MainApp.sResources.getString(R.string.rate) + ": " + DecimalFormatter.to2Decimal(rate) + " U/h " - + "(" + DecimalFormatter.to2Decimal(rate/virtualPumpPlugin.getBaseBasalRate() *100) + "%)\n" + + return MainApp.sResources.getString(R.string.rate) + ": " + DecimalFormatter.to2Decimal(rate) + " U/h " + + "(" + DecimalFormatter.to2Decimal(rate/configBuilder.getBaseBasalRate() *100) + "%)\n" + MainApp.sResources.getString(R.string.duration) + ": " + DecimalFormatter.to0Decimal(duration) + " min\n" + MainApp.sResources.getString(R.string.reason) + ": " + reason; } else @@ -37,13 +37,13 @@ public class APSResult implements Parcelable { } public Spanned toSpanned() { + final ConfigBuilderPlugin configBuilder = MainApp.getConfigBuilder(); if (changeRequested) { String ret = ""; if (rate == 0 && duration == 0) ret = MainApp.sResources.getString(R.string.canceltemp); else - //ECOR Try to % basal rate ret = "" + MainApp.sResources.getString(R.string.rate) + ": " + DecimalFormatter.to2Decimal(rate) + " U/h " + - "(" + DecimalFormatter.to2Decimal(rate/virtualPumpPlugin.getBaseBasalRate() *100) + "%)
" + + "(" + DecimalFormatter.to2Decimal(rate/configBuilder.getBaseBasalRate() *100) + "%)
" + "" + MainApp.sResources.getString(R.string.duration) + ": " + DecimalFormatter.to2Decimal(duration) + " min
" + "" + MainApp.sResources.getString(R.string.reason) + ": " + reason.replace("<", "<").replace(">", ">"); return Html.fromHtml(ret);