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

View File

@ -506,5 +506,7 @@
"you-have-to-provide-an-organization": "Du musst eine Organisation angeben", "you-have-to-provide-an-organization": "Du musst eine Organisation angeben",
"you-have-to-save-your-changes-to-generate-a-link": "Du musst deine Änderungen speichern, um einen Link zu generieren.", "you-have-to-save-your-changes-to-generate-a-link": "Du musst deine Änderungen speichern, um einen Link zu generieren.",
"you-must-create-at-least-one-card-or-cancel": "Du musst mindestens eine Blankokarte erstellen.", "you-must-create-at-least-one-card-or-cancel": "Du musst mindestens eine Blankokarte erstellen.",
"zip-postal-code": "Postleitzahl" "zip-postal-code": "Postleitzahl",
"loading-donors": "Sponsoren werden geladen",
"all-donors-loaded": "Alle Sponsoren geladen"
} }

View File

@ -506,5 +506,7 @@
"you-have-to-provide-an-organization": "You have to provide an organization", "you-have-to-provide-an-organization": "You have to provide an organization",
"you-have-to-save-your-changes-to-generate-a-link": "You have to save your changes to generate a link.", "you-have-to-save-your-changes-to-generate-a-link": "You have to save your changes to generate a link.",
"you-must-create-at-least-one-card-or-cancel": "You must create at least one card.", "you-must-create-at-least-one-card-or-cancel": "You must create at least one card.",
"zip-postal-code": "ZIP/ postal code" "zip-postal-code": "ZIP/ postal code",
"loading-donors": "Loading donors",
"all-donors-loaded": "All donors loaded"
} }