Revert "revert: buggy pagination"

This reverts commit b2648645e8fc05f8742ecfc592557f954261671b.
This commit is contained in:
Nicolai Ort 2023-05-04 19:57:46 +02:00
parent b7a53960e5
commit dacb2f8ace
Signed by: niggl
GPG Key ID: 13AFA55AF62F269F
4 changed files with 75 additions and 28 deletions

View File

@ -167,13 +167,27 @@
} }
onMount(async () => { onMount(async () => {
const donations = await DonationService.donationControllerGetAll(); let page = 0;
current_donations = donations; let pagesize = 100;
options.update((options) => ({ while (page >= 0) {
...options, const donations = await DonationService.donationControllerGetAll(
data: current_donations, page,
})); pagesize
dataLoaded = true; );
if (donations.length == 0) {
page = -2;
}
current_donations = current_donations.concat(...donations);
options.update((options) => ({
...options,
data: current_donations,
}));
dataLoaded = true;
page++;
pagesize += 100;
}
}); });
</script> </script>

View File

@ -146,13 +146,24 @@
} }
onMount(async () => { onMount(async () => {
const donors = await DonorService.donorControllerGetAll(); let page = 0;
current_donors = donors; let pagesize = 100;
options.update((options) => ({ while (page >= 0) {
...options, const donors = await DonorService.donorControllerGetAll(page, pagesize);
data: donors, if (donors.length == 0) {
})); page = -2;
dataLoaded = true; }
current_donors = current_donors.concat(...donors);
options.update((options) => ({
...options,
data: current_donors,
}));
dataLoaded = true;
page++;
pagesize += 100;
}
}); });
</script> </script>

View File

@ -161,13 +161,22 @@
} }
); );
const runners = await RunnerService.runnerControllerGetAll(); let page = 0;
current_runners = runners; while (page >= 0) {
options.update((options) => ({ const runners = await RunnerService.runnerControllerGetAll(page, 500);
...options, if (runners.length == 0) {
data: current_runners, page = -2;
})); }
dataLoaded = true;
current_runners = current_runners.concat(...runners);
options.update((options) => ({
...options,
data: current_runners,
}));
dataLoaded = true;
page++;
}
}); });
</script> </script>

View File

@ -178,13 +178,26 @@
} }
onMount(async () => { onMount(async () => {
const scans = await ScanService.scanControllerGetAll(); let page = 0;
current_scans = scans; let pagesize = 100;
options.update((options) => ({ while (page >= 0) {
...options, const scans = await ScanService.scanControllerGetAll(page, pagesize);
data: current_scans, if (scans.length == 0) {
})); page = -2;
dataLoaded = true; }
current_scans = current_scans.concat(...scans);
options.update((options) => ({
...options,
data: current_scans,
}));
dataLoaded = true;
page++;
if (pagesize < 1000) {
pagesize += 100;
}
}
}); });
</script> </script>