Switched donor loading to non-paginated

This commit is contained in:
Nicolai Ort 2023-05-09 10:43:33 +02:00
parent 6364536dcd
commit 59fe2dfabb
Signed by: niggl
GPG Key ID: 13AFA55AF62F269F
3 changed files with 1036 additions and 1045 deletions

View File

@ -98,35 +98,22 @@
}
}
}
onMount(()=>{
loadDonorsAndRunnersPaginated();
})
async function loadDonorsAndRunnersPaginated() {
let page = 0;
let pagesize = 500;
while (page >= 0) {
const don = await DonorService.donorControllerGetAll(page, pagesize);
const run = await RunnerService.runnerControllerGetAll(page, pagesize);
if (don.length == 0 && run.length == 0) {
page = -2;
onMount(async () => {
toast.loading($_("loading-donors"));
donors = (await DonorService.donorControllerGetAll()).map(
(r) => {
return { label: getDonorLabel(r), value: r };
}
donors = donors.concat(
...run.map((r) => {
return { label: getDonorLabel(r), value: r };
})
);
runners = runners.concat(
...run.map((r) => {
return { label: getDonorLabel(r), value: r };
})
);
dataLoaded = true;
page++;
}
}
);
runners = (await RunnerService.runnerControllerGetAll()).map(
(r) => {
return { label: getDonorLabel(r), value: r };
}
);
toast.dismiss();
toast.success($_("all-donors-loaded"));
});
</script>
{#if modal_open}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff