Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion dtable_events/dtable_io/excel.py
Original file line number Diff line number Diff line change
Expand Up @@ -1625,7 +1625,11 @@ def parse_link(column, cell_data, email2nickname):
else:
options = column.get('data').get('array_data', {}).get('options')
id2name = {op.get('id'): op.get('name') for op in options}
return ', '.join([select_option_to_name(id2name, cell) for cell in cell_data])
return ', '.join([
select_option_to_name(id2name, cell) if isinstance(cell, dict)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[Warning] 缺少混合数据形态回归测试

Why this matters:
本次修复依赖 dtable-db 返回的链接值既可能是旧的 dict,也可能是单选 option ID 字符串;该分支是此次 Excel 导出丢行问题的核心,但仓库中没有覆盖 parse_link 的测试。后续调整 option 映射或空值处理时,可能重新触发导出失败或输出错误标签而 CI 未发现。

Suggested fix: 为 parse_link 增加参数化测试:同时覆盖 dict 与字符串 option ID、多个链接记录,并断言均导出对应的 option name。

else id2name.get(cell_data2str(cell), cell_data2str(cell))
for cell in cell_data
])
elif column.get('data').get('array_type') in (ColumnTypes.CREATOR, ColumnTypes.LAST_MODIFIER):
return ', '.join([
email_to_nickname(email2nickname, cell) if isinstance(cell, dict)
Expand Down
Loading