Don't refresh status twice when setting TBR

Return duration in TBR PumpEnactResult
This commit is contained in:
TebbeUbben 2019-01-19 11:54:05 +01:00
parent 2a126783b7
commit 258034ca8d

View file

@ -611,6 +611,7 @@ public class LocalInsightPlugin extends PluginBase implements PumpInterface, Con
result.enacted = true; result.enacted = true;
result.isPercent = false; result.isPercent = false;
result.absolute = absoluteRate; result.absolute = absoluteRate;
result.duration = durationInMinutes;
result.comment = MainApp.gs(R.string.virtualpump_resultok); result.comment = MainApp.gs(R.string.virtualpump_resultok);
} else { } else {
result.comment = ebResult.comment; result.comment = ebResult.comment;
@ -619,13 +620,13 @@ public class LocalInsightPlugin extends PluginBase implements PumpInterface, Con
result.comment = cancelTBRResult.comment; result.comment = cancelTBRResult.comment;
} }
} else { } else {
result = setTempBasalPercent((int) Math.round(percent), durationInMinutes, profile, enforceNew); return setTempBasalPercent((int) Math.round(percent), durationInMinutes, profile, enforceNew);
} }
} else { } else {
result.comment = cancelEBResult.comment; result.comment = cancelEBResult.comment;
} }
} else { } else {
result = setTempBasalPercent((int) Math.round(percent), durationInMinutes, profile, enforceNew); return setTempBasalPercent((int) Math.round(percent), durationInMinutes, profile, enforceNew);
} }
try { try {
fetchStatus(); fetchStatus();
@ -656,6 +657,7 @@ public class LocalInsightPlugin extends PluginBase implements PumpInterface, Con
} }
result.isPercent = true; result.isPercent = true;
result.percent = percent; result.percent = percent;
result.duration = durationInMinutes;
result.success = true; result.success = true;
result.enacted = true; result.enacted = true;
result.comment = MainApp.gs(R.string.virtualpump_resultok); result.comment = MainApp.gs(R.string.virtualpump_resultok);