356977cd by 周伟奇

fix bug

1 parent f085b3b6
......@@ -542,12 +542,23 @@ class Command(BaseCommand, LoggerMixin):
else:
sheet_name, key_field, side_field_order, field_order = self.field_map[result[self.CLASSIFY_KEY]]
if key_field is not None and key_field in result[self.RESULT_KEY]:
head_fields = [a for a, _ in side_field_order]
else:
head_fields = [a for a, _ in field_order]
head_fields = []
for a, b in side_field_order:
if isinstance(b, str):
head_fields.append(a)
else:
head_fields = []
for a, b in side_field_order:
if isinstance(b, str):
head_fields.append(a)
row = []
for field in head_fields:
row.append(result[self.RESULT_KEY].get(field))
ocr_str_or_list = result[self.RESULT_KEY].get(field, '')
if isinstance(ocr_str_or_list, list):
last_ocr_str = '、'.join(ocr_str_or_list)
else:
last_ocr_str = ocr_str_or_list
row.append(last_ocr_str)
if sheet_name in wb.sheetnames:
ws = wb.get_sheet_by_name(sheet_name)
else:
......
Styling with Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!