diff --git a/project/frontend/src/routes/extractedResult_.$pitchBook.$kpi.tsx b/project/frontend/src/routes/extractedResult_.$pitchBook.$kpi.tsx index 5e42c9f..f388bbc 100644 --- a/project/frontend/src/routes/extractedResult_.$pitchBook.$kpi.tsx +++ b/project/frontend/src/routes/extractedResult_.$pitchBook.$kpi.tsx @@ -72,6 +72,7 @@ function ExtractedResultsPage() { const originalValue = kpiValues[0]?.entity || ""; const originalPage = kpiValues[0]?.page || 0; + // Funktion, um gleiche Werte zusammenzufassen und die Seiten zu sammeln function groupKpiValues(values: Array<{ entity: string; page: number; [key: string]: any }>): Array<{ entity: string; pages: number[]; [key: string]: any }> { const map = new Map(); values.forEach((item: { entity: string; page: number; [key: string]: any }) => { @@ -98,6 +99,7 @@ function ExtractedResultsPage() { ? (parseInt(customPage) > 0 ? parseInt(customPage) : 1) : groupedKpiValues[selectedIndex]?.pages[0] || 1; + // Um zu prüfen, ob der Wert nur aus Leerzeichen besteht const isSelectedValueEmpty = selectedIndex === -1 ? customValue.trim() === "" : !selectedValue; useEffect(() => { @@ -111,6 +113,7 @@ function ExtractedResultsPage() { const updatedData = { ...kpiData }; let baseObject; if (selectedIndex >= 0) { + // Das Originalobjekt mit allen Feldern für diesen Wert suchen const original = kpiValues.find(v => v.entity.toLowerCase() === groupedKpiValues[selectedIndex].entity.toLowerCase()) as { status?: string; source?: string } | undefined; baseObject = { label: kpi.toUpperCase(), @@ -177,6 +180,7 @@ function ExtractedResultsPage() { event: React.ChangeEvent, ) => { const value = event.target.value; + // Allow empty string or positive numbers only (no 0) if (value === '' || (/^\d+$/.test(value) && parseInt(value) > 0)) { setCustomPage(value); }