Merge branch 'stable' into develop
* stable: Fix some typos. BolusCommand: confirm via My Data history the correct amount was delivered.
This commit is contained in:
commit
7099eb8e84
|
@ -70,6 +70,35 @@ public class BolusCommand implements Command {
|
|||
"Bolus delivery did not complete as expected. "
|
||||
+ "Check pump manually, the bolus might not have been delivered.");
|
||||
|
||||
// read last bolus record; those menus display static data and therefore
|
||||
// only a single menu update is sent
|
||||
scripter.navigateToMenu(MenuType.MY_DATA_MENU);
|
||||
scripter.verifyMenuIsDisplayed(MenuType.MY_DATA_MENU);
|
||||
scripter.pressCheckKey();
|
||||
if (scripter.currentMenu.getType() != MenuType.BOLUS_DATA) {
|
||||
scripter.waitForMenuUpdate();
|
||||
}
|
||||
|
||||
if (!scripter.currentMenu.attributes().contains(MenuAttribute.BOLUS)) {
|
||||
throw new CommandException().success(false).enacted(true)
|
||||
.message("Bolus was delivered, but unable to confirm it with history record");
|
||||
}
|
||||
|
||||
double lastBolusInHistory = (double) scripter.currentMenu.getAttribute(MenuAttribute.BOLUS);
|
||||
if (Math.abs(bolus - lastBolusInHistory) > 0.05) {
|
||||
throw new CommandException().success(false).enacted(true)
|
||||
.message("Last bolus shows " + lastBolusInHistory
|
||||
+ " U delievered, but " + bolus + " U were requested");
|
||||
}
|
||||
log.debug("Bolus record in history confirms delivered bolus");
|
||||
|
||||
// leave menu to go back to main menu
|
||||
scripter.pressCheckKey();
|
||||
scripter.waitForMenuToBeLeft(MenuType.BOLUS_DATA);
|
||||
scripter.verifyMenuIsDisplayed(MenuType.MAIN_MENU,
|
||||
"Bolus was correctly delivered and checked against history, but we "
|
||||
+ "did not return the main menu successfully.");
|
||||
|
||||
return new CommandResult().success(true).enacted(true)
|
||||
.message(String.format(Locale.US, "Delivered %02.1f U", bolus));
|
||||
} catch (CommandException e) {
|
||||
|
|
|
@ -234,14 +234,14 @@ public class SetTbrCommand implements Command {
|
|||
// A "TBR CANCELLED alert" is only raised by the pump when the remaining time is
|
||||
// greater than 60s (displayed as 0:01, the pump goes from there to finished.
|
||||
// We could read the remaining duration from MAIN_MENU, but by the time we're here,
|
||||
// the pmup could have moved from 0:02 to 0:01, so instead, check if a "TBR CANCELLED alert"
|
||||
// the pumup could have moved from 0:02 to 0:01, so instead, check if a "TBR CANCELLED" alert
|
||||
// is raised and if so dismiss it
|
||||
long inTwoSeconds = System.currentTimeMillis() + 5 * 1000;
|
||||
long inFiveSeconds = System.currentTimeMillis() + 5 * 1000;
|
||||
boolean alertProcessed = false;
|
||||
while (System.currentTimeMillis() < inTwoSeconds && !alertProcessed) {
|
||||
while (System.currentTimeMillis() < inFiveSeconds && !alertProcessed) {
|
||||
if (scripter.currentMenu.getType() == MenuType.WARNING_OR_ERROR) {
|
||||
// Check the raised alarm is TBR CANCELLED, so we're not accidentally cancelled
|
||||
// a different that might be raised at the same time.
|
||||
// Check the raised alarm is TBR CANCELLED, so we're not accidentally cancelling
|
||||
// a different alarm that might be raised at the same time.
|
||||
// Note that the message is permanently displayed, while the error code is blinking.
|
||||
// A wait till the error code can be read results in the code hanging, despite
|
||||
// menu updates coming in, so just check the message.
|
||||
|
@ -252,10 +252,10 @@ public class SetTbrCommand implements Command {
|
|||
.message("An alert other than the expected TBR CANCELLED was raised by the pump: "
|
||||
+ errorMsg + ". Please check the pump.");
|
||||
}
|
||||
// confirm "TBR CANCELLED alert"
|
||||
// confirm "TBR CANCELLED" alert
|
||||
scripter.verifyMenuIsDisplayed(MenuType.WARNING_OR_ERROR);
|
||||
scripter.pressCheckKey();
|
||||
// dismiss "TBR CANCELLED alert"
|
||||
// dismiss "TBR CANCELLED" alert
|
||||
scripter.verifyMenuIsDisplayed(MenuType.WARNING_OR_ERROR);
|
||||
scripter.pressCheckKey();
|
||||
scripter.waitForMenuToBeLeft(MenuType.WARNING_OR_ERROR);
|
||||
|
|
Loading…
Reference in a new issue