Fix: step 2 -> step 2b/3 workflow
Some checks failed
Build & Push Docker / build (push) Has been cancelled

Problem:
- Když uživatel importoval Excel a klikl 'Upravit v inline editoru' nebo 'Generovat',
  dostal chybu 'Neplatný krok nebo chybějící data'
- step 2b vyžadoval file_item, ale formulář posílal file_content_base64

Řešení:
- Upravena podmínka pro step=2b aby akceptovala i file_content_base64
- Přidány 2 nové testy:
  * test_excel_import_to_step2_workflow - testuje import -> step 2 -> step 3 (generate)
  * test_excel_import_to_inline_editor_workflow - testuje import -> step 2 -> step 2b (inline editor)

Testy: 18/18 unit testů prošlo 
This commit is contained in:
Martin Sukany
2025-11-13 16:15:23 +01:00
parent b7b56fe15f
commit 2f4c930739
2 changed files with 129 additions and 8 deletions

View File

@@ -583,17 +583,28 @@ button:hover { background: #0056b3; }
logger.error(f"Unexpected error: {str(e)}")
render_error(f"Neočekávaná chyba: {str(e)}")
elif step == '2b' and file_item is not None and file_item.filename:
elif step == '2b':
"""Load Excel data into inline editor for editing."""
try:
file_content = file_item.file.read()
file_size = len(file_content)
# Get file content from either file upload or base64
file_content = None
if file_item is not None and file_item.filename:
file_content = file_item.file.read()
else:
file_content_base64 = form.getvalue('file_content_base64', '')
if file_content_base64:
file_content = base64.b64decode(file_content_base64)
# Validate inputs
validate_inputs(title, detail, file_size)
# Read Excel
data, error_rows = read_excel(file_content, show_debug)
if not file_content:
render_error("Chyba: Soubor nebyl nalezen.")
else:
file_size = len(file_content)
# Validate inputs
validate_inputs(title, detail, file_size)
# Read Excel
data, error_rows = read_excel(file_content, show_debug)
if data.empty:
render_error("Načtená data jsou prázdná nebo obsahují neplatné hodnoty. Zkontrolujte vstupní soubor.")