fix bug
Showing
1 changed file
with
15 additions
and
4 deletions
... | @@ -542,12 +542,23 @@ class Command(BaseCommand, LoggerMixin): | ... | @@ -542,12 +542,23 @@ class Command(BaseCommand, LoggerMixin): |
542 | else: | 542 | else: |
543 | sheet_name, key_field, side_field_order, field_order = self.field_map[result[self.CLASSIFY_KEY]] | 543 | sheet_name, key_field, side_field_order, field_order = self.field_map[result[self.CLASSIFY_KEY]] |
544 | if key_field is not None and key_field in result[self.RESULT_KEY]: | 544 | if key_field is not None and key_field in result[self.RESULT_KEY]: |
545 | head_fields = [a for a, _ in side_field_order] | 545 | head_fields = [] |
546 | else: | 546 | for a, b in side_field_order: |
547 | head_fields = [a for a, _ in field_order] | 547 | if isinstance(b, str): |
548 | head_fields.append(a) | ||
549 | else: | ||
550 | head_fields = [] | ||
551 | for a, b in side_field_order: | ||
552 | if isinstance(b, str): | ||
553 | head_fields.append(a) | ||
548 | row = [] | 554 | row = [] |
549 | for field in head_fields: | 555 | for field in head_fields: |
550 | row.append(result[self.RESULT_KEY].get(field)) | 556 | ocr_str_or_list = result[self.RESULT_KEY].get(field, '') |
557 | if isinstance(ocr_str_or_list, list): | ||
558 | last_ocr_str = '、'.join(ocr_str_or_list) | ||
559 | else: | ||
560 | last_ocr_str = ocr_str_or_list | ||
561 | row.append(last_ocr_str) | ||
551 | if sheet_name in wb.sheetnames: | 562 | if sheet_name in wb.sheetnames: |
552 | ws = wb.get_sheet_by_name(sheet_name) | 563 | ws = wb.get_sheet_by_name(sheet_name) |
553 | else: | 564 | else: | ... | ... |
-
Please register or sign in to post a comment