sync: import all visible activities in parallel

The bulk import loop awaited importActivity() one row at a time, so
with N visible activities the browser paid N sequential round trips
(plus each activity's own processing time) back to back. Requests
now fire concurrently via Promise.allSettled, with the button label
updating live as each one finishes. The backend already handles
concurrent activity imports fine -- each goes through its own DB
transaction and its own geo::crossings_for_track query -- so this is
purely a client-side change.
This commit is contained in:
Claude 2026-08-13 09:46:43 +00:00 committed by Jonas Rabenstein
commit 086ad73ebe

View file

@ -663,18 +663,26 @@ if (importAllForm) {
if (button) button.disabled = true;
let done = 0;
for (const row of rows) {
const ok = await importActivity(
row.dataset.athleteId,
row.dataset.activityId,
row
);
if (ok) done += 1;
const updateLabel = () => {
if (button) {
button.textContent =
'Importiere (' + done + '/' + rows.length + ')';
}
}
};
updateLabel();
await Promise.allSettled(
rows.map((row) =>
importActivity(
row.dataset.athleteId,
row.dataset.activityId,
row
).then((ok) => {
if (ok) done += 1;
updateLabel();
})
)
);
if (button) {
button.textContent =