Handle errors when reading the history for verification fails.
This commit is contained in:
parent
25f46fe601
commit
67eb6b20ed
|
@ -511,6 +511,13 @@ public class ComboPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
||||||
log.debug("Trying to determine from pump history what was actually delivered");
|
log.debug("Trying to determine from pump history what was actually delivered");
|
||||||
CommandResult readLastBolusResult = runCommand(MainApp.sResources.getString(R.string.combo_activity_verifying_delivered_bolus), 3,
|
CommandResult readLastBolusResult = runCommand(MainApp.sResources.getString(R.string.combo_activity_verifying_delivered_bolus), 3,
|
||||||
() -> ruffyScripter.readHistory(new PumpHistoryRequest().bolusHistory(PumpHistoryRequest.LAST)));
|
() -> ruffyScripter.readHistory(new PumpHistoryRequest().bolusHistory(PumpHistoryRequest.LAST)));
|
||||||
|
if (!readLastBolusResult.success || readLastBolusResult.history == null) {
|
||||||
|
// this happens when the cartridge runs empty during delivery, the pump will be in an error
|
||||||
|
// state with multiple alarms ringing and no chance of reading history
|
||||||
|
return new PumpEnactResult().success(false).enacted(false)
|
||||||
|
.comment(MainApp.sResources.getString(R.string.combo_error_bolus_verification_failed));
|
||||||
|
}
|
||||||
|
|
||||||
List<Bolus> bolusHistory = readLastBolusResult.history.bolusHistory;
|
List<Bolus> bolusHistory = readLastBolusResult.history.bolusHistory;
|
||||||
Bolus lastBolus = !bolusHistory.isEmpty() ? bolusHistory.get(0) : null;
|
Bolus lastBolus = !bolusHistory.isEmpty() ? bolusHistory.get(0) : null;
|
||||||
|
|
||||||
|
|
|
@ -840,5 +840,6 @@
|
||||||
<string name="combo_error_no_bolus_delivered">Bolus delivery failed. It appears no bolus was delivered. To be sure, please check the pump to avoid a double bolus and then bolus again. To guard against bugs, boluses are not automatically retried.</string>
|
<string name="combo_error_no_bolus_delivered">Bolus delivery failed. It appears no bolus was delivered. To be sure, please check the pump to avoid a double bolus and then bolus again. To guard against bugs, boluses are not automatically retried.</string>
|
||||||
<string name="combo_error_partial_bolus_delivered">Only %.2f U of the requested bolus of %.2f U was delivered due to an error. Please check the pump to verify this and take appropriate actions.</string>
|
<string name="combo_error_partial_bolus_delivered">Only %.2f U of the requested bolus of %.2f U was delivered due to an error. Please check the pump to verify this and take appropriate actions.</string>
|
||||||
<string name="combo_activity_verifying_delivered_bolus">Verifying delivered bolus</string>
|
<string name="combo_activity_verifying_delivered_bolus">Verifying delivered bolus</string>
|
||||||
|
<string name="combo_error_bolus_verification_failed">Delivering the bolus and verifying the pump\'s history failed, please check the pump and manually create a bolus record using the Careportal tab if a bolus was delivered.</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue