MOBILE-3833 feedback: Fix attempts pagination

main
Noel De Martin 2022-03-17 15:40:14 +01:00
parent 22c482bdda
commit 02c2a5e508
1 changed files with 8 additions and 2 deletions

View File

@ -135,8 +135,14 @@ export class AddonModFeedbackAttemptsSource extends CoreRoutedItemsManagerSource
const totalItemsLoaded = this.getPageLength() * (page + 1);
const pageAttempts: AddonModFeedbackAttemptItem[] = [
...result.attempts,
...result.anonattempts,
// The page argument is ignored in the webservice when there is only one page,
// so we should ignore the responses of pages beyond the first if that's the case.
...(page === 0 || result.totalattempts > AddonModFeedbackProvider.PER_PAGE)
? result.attempts
: [],
...(page === 0 || result.totalanonattempts > AddonModFeedbackProvider.PER_PAGE)
? result.anonattempts
: [],
];
return {