Repository navigation
fix: correct off-by-one error in PageOverview row count - #862
Conversation
1. Root cause: PageOverview::updateInfo called setColumnAndRow(row - 1) where row equals map.size(), causing table rows to be N-1 instead of N+1; the last data row index fell outside valid range and was silently dropped by Qt 2. Fix: change setColumnAndRow(row - 1) to setColumnAndRow(row + 1) to reserve one extra row for the expand/collapse button, matching PageSingleInfo and PageBoardInfo usage 3. Impact: single-entry maps no longer show empty tables; all entries display correctly in the overview table for both single and multi entry scenarios Log: Fix overview table showing empty or missing last row Influence: 1. Test overview page with single device entry to verify table is not empty 2. Test overview page with multiple device entries to verify all rows display 3. Verify expand/collapse button still works correctly on overview page fix: 修复概览页表格行数差一错误 1. 根因:PageOverview::updateInfo 调用 setColumnAndRow(row - 1),其中 row 等于 map.size(),导致表格行数为 N-1 而非 N+1;最后一行数据 索引超出有效范围被 Qt 静默丢弃 2. 方案:将 setColumnAndRow(row - 1) 改为 setColumnAndRow(row + 1), 预留一行用于展开/收起按钮,与 PageSingleInfo 和 PageBoardInfo 用法一致 3. 影响:单条目 map 不再显示空表格;多条目场景下所有条目均能正确显示 Log: 修复概览页表格显示为空或末行丢失的问题 Influence: 1. 测试单设备条目下概览页表格非空 2. 测试多设备条目下概览页所有行均显示 3. 验证概览页展开/收起按钮功能正常 PMS: BUG-3
Reviewer's guide (collapsed on small PRs)Reviewer's GuideFixes an off-by-one error in Sequence diagram for overview table row allocationsequenceDiagram
participant Caller
participant PageOverview
participant OverviewTable
Caller->>PageOverview: updateInfo(map)
PageOverview->>OverviewTable: setColumnAndRow(map.size() + 1)
OverviewTable-->>PageOverview: Reserve data rows and control row
PageOverview->>OverviewTable: Populate overview entries
PageOverview->>OverviewTable: Populate expand/collapse control row
File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
deepin pr auto review🤖 AI 代码审查报告📊 总体评价
🔍 详细分析1. 语法逻辑 ✅评价: 语法正确,逻辑清晰 ✅ 通过 潜在问题: 建议: ['建议将 mp_Overview->setColumnAndRow(row + 1) 改为 mp_Overview->setColumnAndRow(row),使表格行数精确匹配实际数据条目数,避免 UI 中出现多余的空行'] 2. 代码质量 ✅评价: 代码结构清晰,注释完整 ✅ 通过 潜在问题: 建议: [] 3. 代码性能 ✅评价: 性能良好,资源使用合理 ✅ 通过 潜在问题: 建议: [] 4. 代码安全 🔒评价: 存在0个安全漏洞 ✅ 通过
安全漏洞详情: 建议: [] 💡 改进建议代码示例// 设置表格行数
mp_Overview->setColumnAndRow(row);本报告由 AI 代码审查工具自动生成 |
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: add-uos, lzwind The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
/forcemerge |
PR #862 corrected the off-by-one in PageOverview::updateInfo (setColumnAndRow(row - 1) -> row + 1) after the rewritten PageOverview tests had already been merged, leaving updateInfo_emptyMap_rowMinusOne pinning the old buggy semantics: with an empty map the stub now receives 1 instead of -1, so that case fails on current master. Rename the case to updateInfo_emptyMap_passesRowPlusOne, assert the fixed semantics (g_colRow == 1) and refresh the stale row-1 comments in the related cases. All 107 Page-suite cases (PageSingleInfo 39, PageMultiInfo 34, PageOverview 17, PageBoardInfo 17) pass on current master. Log: 修正 PageOverview 空表用例预期, 与 row+1 修复语义对齐 Influence: 仅测试代码, 不影响业务逻辑
fix: correct off-by-one error in PageOverview row count
where row equals map.size(), causing table rows to be N-1 instead of
N+1; the last data row index fell outside valid range and was silently
dropped by Qt
reserve one extra row for the expand/collapse button, matching
PageSingleInfo and PageBoardInfo usage
display correctly in the overview table for both single and multi
entry scenarios
Log: Fix overview table showing empty or missing last row
Influence:
fix: 修复概览页表格行数差一错误
row 等于 map.size(),导致表格行数为 N-1 而非 N+1;最后一行数据
索引超出有效范围被 Qt 静默丢弃
预留一行用于展开/收起按钮,与 PageSingleInfo 和 PageBoardInfo 用法一致
Log: 修复概览页表格显示为空或末行丢失的问题
Influence:
PMS: BUG-3
Summary by Sourcery
Bug Fixes: