fix(sync): use ViewState extraction for Untersuchungen pagination instead of form submit

This commit is contained in:
Matthias Hochmeister
2026-04-19 19:37:17 +02:00
parent b401b75b9a
commit 3b4a14661c

View File

@@ -979,15 +979,23 @@ async function scrapeMemberUntersuchungen(
return []; return [];
} }
// Show all rows: select "ALLE", then explicitly submit the form so ASP.NET // ASP.NET needs ViewState to properly process anzeige_count.
// processes the request with its server-generated ViewState. // Extract it from the loaded page and re-navigate with all params + ALLE.
await selectAlleAnzeige(frame); const formState = await frame.evaluate(() => {
const submitBtn = frame.locator('input[type="image"][src*="suchen"]'); const vs = (document.getElementById('__VIEWSTATE') as HTMLInputElement)?.value ?? '';
if (await submitBtn.count() > 0) { const vsg = (document.getElementById('__VIEWSTATEGENERATOR') as HTMLInputElement)?.value ?? '';
await Promise.all([ return { vs, vsg };
frame.waitForNavigation({ waitUntil: 'networkidle', timeout: 15000 }).catch(() => {}), }).catch(() => ({ vs: '', vsg: '' }));
submitBtn.click(),
]); if (formState.vs) {
const alleUrl = `${BASE_URL}/fdisk/module/mgvw/untersuchungen/UntersuchungenList.aspx`
+ `?__VIEWSTATE=${encodeURIComponent(formState.vs)}`
+ `&__VIEWSTATEGENERATOR=${encodeURIComponent(formState.vsg)}`
+ `&searchdatum=&searchanmerkungen=&searchid_untersuchungsarten=`
+ `&searchid_personen=${idPersonen}&searchid_mitgliedschaften=${idMitgliedschaft}`
+ `&id_personen=${idPersonen}&id_mitgliedschaften=${idMitgliedschaft}`
+ `&anzeige_count=ALLE&offset=0&ordnung=2&orderType=ASC&search=1`;
await frame_goto(frame, alleUrl);
} }
// Try to navigate to history/detail view if available // Try to navigate to history/detail view if available