fix: input validierung überspringt erstes sheet, weil diese nur zur Übersicht ist
This commit is contained in:
1 parent
1e44aaab9d
commit
31cdc7747f
3 files changed
+52
-9
No files matched your search
@@ -75,15 +75,30 @@ with col1:
|
||||
input_path = Path(app_config.input_dir) / selected_input
|
||||
# Validiere und parse sofort
|
||||
with st.spinner("Validiere Input-Datei…"):
|
||||
val_result = validate_input_file(input_path, app_config.input_schema)
|
||||
val_result = validate_input_file(input_path, app_config.input_schema, app_config.month_sheet_pattern)
|
||||
|
||||
if not val_result.is_valid:
|
||||
st.markdown(
|
||||
'<div style="border:2px solid #e74c3c; border-radius:8px; padding:12px; '
|
||||
'background:#fdedec; margin-bottom:12px">'
|
||||
'<span style="color:#b03a2e; font-weight:bold; font-size:1.1em">'
|
||||
'❌ Validierung fehlgeschlagen</span></div>',
|
||||
unsafe_allow_html=True,
|
||||
)
|
||||
for err in val_result.errors:
|
||||
st.error(err)
|
||||
st.error(f"🔴 {err}")
|
||||
st.session_state.input_validated = False
|
||||
else:
|
||||
for warn in val_result.warnings:
|
||||
st.warning(warn)
|
||||
if val_result.warnings:
|
||||
st.markdown(
|
||||
'<div style="border:2px solid #f39c12; border-radius:8px; padding:8px 12px; '
|
||||
'background:#fef9e7; margin-bottom:8px">'
|
||||
'<span style="color:#7d6608; font-weight:bold">'
|
||||
'⚠️ Hinweise</span></div>',
|
||||
unsafe_allow_html=True,
|
||||
)
|
||||
for warn in val_result.warnings:
|
||||
st.warning(warn)
|
||||
|
||||
# Parse die Datei
|
||||
records = parse_input_file(
|
||||
@@ -130,8 +145,15 @@ with col2:
|
||||
tpl_result = validate_template(template_path, app_config.output_mapping)
|
||||
|
||||
if not tpl_result.is_valid:
|
||||
st.markdown(
|
||||
'<div style="border:2px solid #e74c3c; border-radius:8px; padding:12px; '
|
||||
'background:#fdedec; margin-bottom:12px">'
|
||||
'<span style="color:#b03a2e; font-weight:bold; font-size:1.1em">'
|
||||
'❌ Validierung fehlgeschlagen</span></div>',
|
||||
unsafe_allow_html=True,
|
||||
)
|
||||
for err in tpl_result.errors:
|
||||
st.error(err)
|
||||
st.error(f"🔴 {err}")
|
||||
st.session_state.template_validated = False
|
||||
else:
|
||||
st.session_state.template_validated = True
|
||||
@@ -139,6 +161,13 @@ with col2:
|
||||
total = tpl_result.info.get("total_target_cells", 0)
|
||||
st.success(f"✅ {found}/{total} Zielfelder gefunden")
|
||||
if tpl_result.warnings:
|
||||
st.markdown(
|
||||
'<div style="border:2px solid #f39c12; border-radius:8px; padding:8px 12px; '
|
||||
'background:#fef9e7; margin-bottom:8px">'
|
||||
'<span style="color:#7d6608; font-weight:bold">'
|
||||
'⚠️ Hinweise</span></div>',
|
||||
unsafe_allow_html=True,
|
||||
)
|
||||
for warn in tpl_result.warnings:
|
||||
st.warning(warn)
|
||||
|
||||
|
||||
Reference in new issue
Block a user