diff --git a/site/app.py b/site/app.py index d9bfc4f..5270a5b 100644 --- a/site/app.py +++ b/site/app.py @@ -150,7 +150,7 @@ class ContractsApp: for s in supp_rows: # Пропустить уже распарсенные existing, _ = db.query( - "SELECT 1 FROM documents WHERE id=%s AND status='parsed'", (s["doc_id"],) + "SELECT 1 FROM documents WHERE id=%s AND status IN ('parsed','expanded')", (s["doc_id"],) ) if existing and existing["rows"]: continue @@ -179,7 +179,6 @@ class ContractsApp: for zname in zf.namelist(): if zname.endswith("/"): continue - zip_names.append(zname) zdata = zf.read(zname) zmime = mimeutil.guess_mime(zname) or "application/octet-stream" @@ -191,6 +190,8 @@ class ContractsApp: ): continue + zip_names.append(zname) + # Сохранить как отдельный документ db.execute( "INSERT INTO documents (filename, mime_type, original_bytes, status) VALUES (%s,%s,%s,'uploaded')", diff --git a/site/templates/upload.html b/site/templates/upload.html index f2119e5..90dba85 100644 --- a/site/templates/upload.html +++ b/site/templates/upload.html @@ -47,7 +47,7 @@