ReadQuickInfoCommand: only read as many boluses as are available.
(cherry picked from commit 7857abb)
This commit is contained in:
parent
183edfcc09
commit
2a5c28cf6b
1 changed files with 9 additions and 3 deletions
|
@ -36,14 +36,20 @@ public class ReadQuickInfoCommand extends BaseCommand {
|
||||||
scripter.verifyMenuIsDisplayed(MenuType.BOLUS_DATA);
|
scripter.verifyMenuIsDisplayed(MenuType.BOLUS_DATA);
|
||||||
List<Bolus> bolusHistory = new ArrayList<>(numberOfBolusRecordsToRetrieve);
|
List<Bolus> bolusHistory = new ArrayList<>(numberOfBolusRecordsToRetrieve);
|
||||||
result.history = new PumpHistory().bolusHistory(bolusHistory);
|
result.history = new PumpHistory().bolusHistory(bolusHistory);
|
||||||
for(int recordsLeftToRead = numberOfBolusRecordsToRetrieve; recordsLeftToRead > 0; recordsLeftToRead--) {
|
// read bolus records
|
||||||
scripter.verifyMenuIsDisplayed(MenuType.BOLUS_DATA);
|
int totalRecords = (int) scripter.getCurrentMenu().getAttribute(MenuAttribute.TOTAL_RECORD);
|
||||||
bolusHistory.add(readBolusRecord());
|
|
||||||
int record = (int) scripter.getCurrentMenu().getAttribute(MenuAttribute.CURRENT_RECORD);
|
int record = (int) scripter.getCurrentMenu().getAttribute(MenuAttribute.CURRENT_RECORD);
|
||||||
|
while (true) {
|
||||||
|
bolusHistory.add(readBolusRecord());
|
||||||
|
if (bolusHistory.size() == numberOfBolusRecordsToRetrieve || record == totalRecords) {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// advance to next record
|
||||||
scripter.pressDownKey();
|
scripter.pressDownKey();
|
||||||
while (record == (int) scripter.getCurrentMenu().getAttribute(MenuAttribute.CURRENT_RECORD)) {
|
while (record == (int) scripter.getCurrentMenu().getAttribute(MenuAttribute.CURRENT_RECORD)) {
|
||||||
scripter.waitForScreenUpdate();
|
scripter.waitForScreenUpdate();
|
||||||
}
|
}
|
||||||
|
record = (int) scripter.getCurrentMenu().getAttribute(MenuAttribute.CURRENT_RECORD);
|
||||||
}
|
}
|
||||||
if (log.isDebugEnabled()) {
|
if (log.isDebugEnabled()) {
|
||||||
if (!result.history.bolusHistory.isEmpty()) {
|
if (!result.history.bolusHistory.isEmpty()) {
|
||||||
|
|
Loading…
Reference in a new issue