fix(report): approverName uses only included days

Move reviewer tracking logic inside the non-empty rows guard in both
approved-only and include-unapproved modes. This ensures zero-row
approved sheets don't pollute the reviewer set, fixing the approverName
calculation to only consider reviewers from included ReportDays.

Add test: approved sheet with zero rows and different reviewer correctly
excluded from approver tracking.

All 9 tests passing.
Co-Authored-By: claude-flow <ruv@ruv.net>
This commit is contained in:
2026-09-28 18:47:18 +08:00
parent f56a3057d4
commit 87014d1656
2 changed files with 90 additions and 8 deletions
@@ -129,11 +129,11 @@ AccomplishmentReportData buildAccomplishmentReportData({
(secondsByCategory[row.category] ?? 0) + row.seconds;
}
}
}
// Track reviewers for approved sheets
if (sheet.status == DaySheetStatus.approved && sheet.reviewedBy != null) {
allReviewers.add(sheet.reviewedBy!);
// Track reviewers for included approved sheets only
if (sheet.status == DaySheetStatus.approved && sheet.reviewedBy != null) {
allReviewers.add(sheet.reviewedBy!);
}
}
}
} else {
@@ -159,11 +159,11 @@ AccomplishmentReportData buildAccomplishmentReportData({
(secondsByCategory[row.category] ?? 0) + row.seconds;
}
}
}
// Track reviewer
if (sheet.reviewedBy != null) {
allReviewers.add(sheet.reviewedBy!);
// Track reviewer for included sheets only
if (sheet.reviewedBy != null) {
allReviewers.add(sheet.reviewedBy!);
}
}
} else if (sheet.status == DaySheetStatus.pending) {
excludedPending++;