fix: Fehler-Feedback Kreditzuordnung, robustes PDF-Fehlerhandling

Kreditzuordnung im Szenario prueft jetzt response.ok, zeigt bei Fehlschlag
eine deutsche Meldung und macht die Checkbox-Aenderung rueckgaengig statt
stillschweigend neu zu laden. process_pdf faengt zusaetzlich zu ParserError
auch unerwartete Parser-Exceptions (z.B. pdfminer bei strukturell kaputten
PDFs) ab und legt dafuer ein sauberes error-Statement an statt eines
unbehandelten 500; die Datei bleibt dabei im Posteingang.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
2026-07-17 19:14:43 +02:00
parent afbbcbe9a5
commit df6615c8f7
3 changed files with 51 additions and 9 deletions

View File

@@ -204,7 +204,7 @@
{% for l in loans %}
<label class="inline-form">
<input type="checkbox" {% if l.id in row.assigned_loan_ids %}checked{% endif %}
onchange="toggleScenarioLoan({{ sc.id }}, {{ l.id }}, this.checked)">
onchange="toggleScenarioLoan({{ sc.id }}, {{ l.id }}, this.checked, this)">
{{ l.name }}
</label>
{% else %}
@@ -354,9 +354,18 @@
recSelect.disabled = isCategory;
}
function toggleScenarioLoan(scenarioId, loanId, checked) {
function toggleScenarioLoan(scenarioId, loanId, checked, checkbox) {
fetch('/api/scenarios/' + scenarioId + '/loans/' + loanId, { method: checked ? 'POST' : 'DELETE' })
.then(function () { window.location.reload(); });
.then(function (resp) {
if (!resp.ok) {
throw new Error('HTTP ' + resp.status);
}
window.location.reload();
})
.catch(function (err) {
checkbox.checked = !checked;
alert('Zuordnung fehlgeschlagen: ' + err.message);
});
}
var loadedSchedules = {};