Skip to content

Commit

Permalink
SAK-41834 change isItemComplete start sequence to 0 (sakaiproject#6945)
Browse files Browse the repository at this point in the history
  • Loading branch information
adrianfish authored and ern committed May 22, 2019
1 parent 6aae6e5 commit 84c65ff
Showing 1 changed file with 13 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -5239,21 +5239,20 @@ else if (item.getType() == SimplePageItem.PAGE) {

private boolean arePageItemsComplete(long pageId) {

int sequence = 1;
SimplePageItem i = simplePageToolDao.findNextItemOnPage(pageId, sequence);

while (i != null) {
if (i.isRequired() && !isItemComplete(i) && isItemVisible(i))
return false;

sequence++;
i = simplePageToolDao.findNextItemOnPage(pageId, sequence);
}
int sequence = 0;
SimplePageItem i = simplePageToolDao.findNextItemOnPage(pageId, sequence);

while (i != null) {
if (i.isRequired() && !isItemComplete(i) && isItemVisible(i)) {
return false;
}
sequence++;
i = simplePageToolDao.findNextItemOnPage(pageId, sequence);
}

return true;
return true;
}


// this is called in a loop to see whether items are available. Since computing it can require
// database transactions, we cache the results
public boolean isItemComplete(SimplePageItem item) {
Expand Down Expand Up @@ -5543,7 +5542,6 @@ public boolean isPageComplete(long itemId,Set<Long>alreadySeen) {
return true;
}


List<SimplePageItem> items = getItemsOnPage(Long.valueOf(findItem(itemId).getSakaiId()));

for (SimplePageItem item : items) {
Expand Down Expand Up @@ -5624,8 +5622,9 @@ public List<String> pagesNeeded(SimplePageItem item) {
if (i.getSakaiId().equals(currentPageId)) {
return needed; // reached current page. we're done
}
if (i.isRequired() && !isItemComplete(i) && isItemVisible(i))
if (i.isRequired() && !isItemComplete(i) && isItemVisible(i)) {
needed.add(i.getName());
}
}

return needed;
Expand Down

0 comments on commit 84c65ff

Please sign in to comment.