SetBasalCommand: actually confirm entered values.

This commit is contained in:
Johannes Mockenhaupt 2017-11-23 00:11:45 +01:00
parent 61d1028011
commit 0558e23eb4
No known key found for this signature in database
GPG key ID: 9E1EA6AF7BBBB0D1
3 changed files with 10 additions and 3 deletions

View file

@ -92,4 +92,3 @@
- Application shut down is broken with PersistentNotification (never shut down) and WearPlugin -
Android logs it as crashed and restarts it, thereby restarting the app (or just keeping it alive,
also causes errors with the DB as there were attemtps to open a closed DB instance/ref.
- [ ] Button on Combo tab to confirm any warning (if active)?

View file

@ -35,8 +35,12 @@ public class BasalProfile {
@Override
public String toString() {
double total = 0d;
for(int i = 0; i < 23; i++) {
total += hourlyRates[i];
}
return "BasalProfile{" +
"hourlyRates=" + Arrays.toString(hourlyRates) +
"hourlyRates=" + Arrays.toString(hourlyRates) + ", total " + total + " U" +
'}';
}
}

View file

@ -50,6 +50,7 @@ public class SetBasalProfileCommand extends BaseCommand {
log.debug("Set basal profile, hour " + i + ": " + requestedRate);
}
// move from hourly values to basal total
scripter.pressCheckKey();
scripter.verifyMenuIsDisplayed(MenuType.BASAL_TOTAL);
@ -63,6 +64,9 @@ public class SetBasalProfileCommand extends BaseCommand {
throw new CommandException("Basal total of " + pumpTotal + " differs from requested total of " + requestedTotal);
}
// confirm entered basal rate
scripter.pressCheckKey();
scripter.returnToRootMenu();
scripter.verifyRootMenuIsDisplayed();
@ -76,7 +80,7 @@ public class SetBasalProfileCommand extends BaseCommand {
if (Math.abs(currentRate - requestedRate) < 0.01) {
return null;
}
log.debug("Current rate: " + currentRate + " = requested => " + requestedRate);
log.debug("Current rate: " + currentRate + ", requested: " + requestedRate);
double change = requestedRate - currentRate;
long steps = Math.round(change * 100);
boolean increasing = steps > 0;