fix(qa-dashboard): 已结束月份不再拉伸到当前,区域统计跟随所选区间
build / build (push) Failing after 24s

This commit is contained in:
Zhero & 助理
2026-12-03 22:45:34 +08:00
committed by 姚章浩
parent 6826f37bbd
commit d7a3aed80a
5 changed files with 61 additions and 6 deletions
+8 -1
View File
@@ -249,6 +249,13 @@ func (s *Store) readDashboard(ctx context.Context, q dobotaiops.RecordQuery, mas
out.Regions = append(out.Regions, r)
}
inPeriod := 0
regionFrom := out.MonthStart
if q.Granularity != "" {
// 区域统计跟随所选区间:按天/周/月/自定义看板里,"这个区间用了多少"才是
// 用户要的数字。老周看板(granularity 为空)保持原来的自然月累计不变,
// 周报生成链路逐字段不变。分母仍是月度通讯录人数,由前端注明快照月份。
regionFrom = q.Window.Start
}
for _, r := range records {
if q.Granularity == "" {
if !r.at.Before(out.WeekStart) {
@@ -269,7 +276,7 @@ func (s *Store) readDashboard(ctx context.Context, q dobotaiops.RecordQuery, mas
products[dashboardCategory(v.Effective.ProductCategory)]++
types[dashboardCategory(v.Effective.ProblemType)]++
}
if !r.at.Before(out.MonthStart) {
if !r.at.Before(regionFrom) {
person := attribution.Resolve(r.identity.StaffID, r.identity.UnionID, r.fields["asker"], r.fields["trigger_person"])
if index, ok := regionIndex[person.Region]; ok && person.PersonID != "" {
out.Regions[index].Questions++