Spaces:
Running
Running
Update updated_word.py
Browse files- updated_word.py +11 -11
updated_word.py
CHANGED
|
@@ -999,7 +999,7 @@ def fix_management_summary_details_column(table, flat_json):
|
|
| 999 |
replacements_made += cell_replacements
|
| 1000 |
print(f" ✅ Replaced Std 6. Internal Review details")
|
| 1001 |
|
| 1002 |
-
return replacements_made
|
| 1003 |
|
| 1004 |
def fix_operator_declaration_empty_values(table, flat_json):
|
| 1005 |
"""Fix Operator Declaration table when values are empty"""
|
|
@@ -1273,16 +1273,16 @@ def process_tables(document, flat_json):
|
|
| 1273 |
management_summary_fix = handle_management_summary_fix(cell, flat_json)
|
| 1274 |
replacements_made += management_summary_fix
|
| 1275 |
|
| 1276 |
-
|
| 1277 |
-
|
| 1278 |
-
|
| 1279 |
-
|
| 1280 |
-
|
| 1281 |
-
|
| 1282 |
-
|
| 1283 |
-
|
| 1284 |
-
|
| 1285 |
-
|
| 1286 |
|
| 1287 |
return replacements_made
|
| 1288 |
|
|
|
|
| 999 |
replacements_made += cell_replacements
|
| 1000 |
print(f" ✅ Replaced Std 6. Internal Review details")
|
| 1001 |
|
| 1002 |
+
return replacements_made # ✅ This return is INSIDE the function
|
| 1003 |
|
| 1004 |
def fix_operator_declaration_empty_values(table, flat_json):
|
| 1005 |
"""Fix Operator Declaration table when values are empty"""
|
|
|
|
| 1273 |
management_summary_fix = handle_management_summary_fix(cell, flat_json)
|
| 1274 |
replacements_made += management_summary_fix
|
| 1275 |
|
| 1276 |
+
# 🎯 SURGICAL FIX 3: Handle Operator Declaration tables (only check last few tables)
|
| 1277 |
+
print(f"\n🎯 SURGICAL FIX: Checking for Operator/Auditor Declaration tables...")
|
| 1278 |
+
for table in document.tables[-3:]: # Only check last 3 tables
|
| 1279 |
+
if len(table.rows) <= 4: # Only small tables
|
| 1280 |
+
declaration_fix = handle_operator_declaration_fix(table, flat_json)
|
| 1281 |
+
replacements_made += declaration_fix
|
| 1282 |
+
# Check for declaration tables that need fixing
|
| 1283 |
+
if "print name" in table_text and "position" in table_text:
|
| 1284 |
+
declaration_fixes = fix_operator_declaration_empty_values(table, flat_json)
|
| 1285 |
+
replacements_made += declaration_fixes
|
| 1286 |
|
| 1287 |
return replacements_made
|
| 1288 |
|