feat(qaops): 区域统计展示直属人员与多部门兼属
build / build (push) Successful in 1m12s

按稳定身份展示零使用人员、个人次数与最近提问时间,直接部门去重计算兼属数量;保留原分支统计、配置和源问答。

验证:396项前端测试及类型检查通过;隔离PG全mirror/org竞态回归通过,个人/别名/同名/零使用/未关联与原部门汇总回归通过。
正式同镜像及上线验证尚未执行。
This commit is contained in:
姚章浩
2026-10-21 17:17:08 +08:00
parent cb9f0c389f
commit 99d6109bef
11 changed files with 519 additions and 67 deletions
@@ -64,6 +64,21 @@ func TestDepartmentStatisticsReadsMasterAndInvalidatesCurrentDirectory(t *testin
if ready.Snapshot.TotalVisits != 3 || ready.Snapshot.TotalPeople != 2 || ready.Snapshot.Organization.DirectoryID != state.DirectoryID {
t.Fatal("statistics used mirror-only records or wrong roster")
}
if len(ready.Snapshot.People) != 2 {
t.Fatal("personal roster missing from real persisted statistics")
}
personalAliasFound := false
for _, person := range ready.Snapshot.People {
if len(person.DepartmentIDs) == 2 {
personalAliasFound = true
if person.Visits != 2 || person.LastAskedAt == nil {
t.Fatal("staff/union aliases were not aggregated per person")
}
}
}
if !personalAliasFound {
t.Fatal("direct multiple memberships lost in cached snapshot")
}
rows := map[string]qaopsorg.DepartmentStatistic{}
for _, r := range ready.Snapshot.Rows {
rows[r.ID] = r