Skip to content

handle group structrue when export view to excel in dtable-events instead of via-dtable-server - #904

Merged
freeplant merged 2 commits into
masterfrom
handle-group-struct-in-export-view
Aug 19, 2026
Merged

freeplant merged 2 commits into
masterfrom
handle-group-struct-in-export-view

Conversation

@AlexCXC

@AlexCXC AlexCXC commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

No description provided.

@seafile-dev seafile-dev left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

结论:请求修改

阻塞问题:

  • 部门单选分组的升降序与 sort_type 相反,导出结果无法保持视图分组顺序(见行内评论)。

警告:

  • 新增的分组、排序和汇总算法尚未附带自动化回归测试;本次已验证普通编译通过,但建议覆盖各列类型、空值、嵌套分组及汇总。
    建议修复:为 excel_group 增加独立单元测试,至少断言每种 sort_type 的分组顺序和汇总结果。

if effective_type in TEXT_SORTER_COLUMN_TYPES or effective_type == FormulaResultType.STRING:
return _sort_text(left, right, sort_type)
if effective_type in NUMBER_SORTER_COLUMN_TYPES:
return _sort_number(left, right, sort_type)

@seafile-dev seafile-dev Aug 18, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

【严重】部门分组排序方向相反

影响:
当部门单选列按 sort_type="up" 分组时,left > right 返回 -1,结果会把较大的部门 ID 排在前;down 同样得到升序。这与设计文档要求的按 group_by.sort_type 保持组间顺序相反,会导致该类型的导出分组顺序与视图不一致。

建议修复:将这两个比较分支改为与 _sort_number 一致:升序时较大值返回 1,降序时返回 -1;并补充 updown 及空值置后的回归测试。

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

@freeplant
freeplant merged commit 94fad44 into master Aug 19, 2026
1 check passed
@freeplant
freeplant deleted the handle-group-struct-in-export-view branch August 19, 2026 01:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants