MDL-64194 block_myoverview: incorrect pagination

The pagination was found to be incorrect due to the all the items event not being triggered if the amount
of courses the user has is equal to the amount set via pagination.
The condition could not just be changed to `>=` as this would trigger the event when there were further
pages to display.
A check of `remainingCourses` was added to condition so if the amount of courses on the current loaded
page is less than the pagination amount, or there are no remaining courses, the all items event is
triggered and the pagination bar hidden correctly.
This commit is contained in:
Tom Dickman 2019-03-18 10:36:45 +11:00
parent 0920f35ed9
commit e04b82d30d
2 changed files with 2 additions and 2 deletions

File diff suppressed because one or more lines are too long

View File

@ -499,7 +499,7 @@ function(
}
// Set the last page to either the current or next page
if (loadedPages[currentPage].courses.length < pageData.limit) {
if (loadedPages[currentPage].courses.length < pageData.limit || !remainingCourses.length) {
lastPage = currentPage;
actions.allItemsLoaded(currentPage);
} else if (loadedPages[currentPage + 1] != undefined