根因为“结果不清”或未归因的判错记录移出正确率分母,并以 unjudged 单独返回,覆盖率口径不变。 统计规则版本升到 calendar-month-strict-yes-over-yes-no-v2,前端严格解析同步接受该字段。
This commit is contained in:
@@ -2,11 +2,12 @@ package qaopsmirror
|
||||
|
||||
import (
|
||||
"knowledge-governance/internal/qaopsquality"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
|
||||
const dashboardMonthlySource = "master_live_calendar_month_v1"
|
||||
const dashboardMonthlyPolicy = "calendar-month-strict-yes-over-yes-no-v1"
|
||||
const dashboardMonthlyPolicy = "calendar-month-strict-yes-over-yes-no-v2"
|
||||
|
||||
type DashboardQualityPeriod struct {
|
||||
Month string `json:"month"`
|
||||
@@ -20,6 +21,7 @@ type DashboardStrictQuality struct {
|
||||
Records int `json:"records"`
|
||||
Coverage qaopsquality.Rate `json:"coverage"`
|
||||
Correctness qaopsquality.Rate `json:"correctness"`
|
||||
Unjudged int `json:"unjudged"`
|
||||
}
|
||||
type DashboardMonth struct {
|
||||
Month string `json:"month"`
|
||||
@@ -52,6 +54,14 @@ func dashboardStrictQuality(records []dashboardTimedQuality, start, end time.Tim
|
||||
case "uncovered":
|
||||
uncovered++
|
||||
}
|
||||
// An answer whose correctness cannot be established is not a wrong answer:
|
||||
// "结果不清" and a missing root cause both mean the judge could not attribute a
|
||||
// concrete defect, so they leave the correctness denominator and are surfaced
|
||||
// separately instead of silently inflating the error count.
|
||||
if dashboardUnjudged(r.view) {
|
||||
out.Unjudged++
|
||||
continue
|
||||
}
|
||||
switch r.view.Effective.Correctness {
|
||||
case "correct":
|
||||
correct++
|
||||
@@ -64,6 +74,16 @@ func dashboardStrictQuality(records []dashboardTimedQuality, start, end time.Tim
|
||||
return out
|
||||
}
|
||||
|
||||
func dashboardUnjudged(v qaopsquality.View) bool {
|
||||
if v.State == "stale" || v.Effective.Correctness != "incorrect" {
|
||||
return false
|
||||
}
|
||||
cause := strings.TrimSpace(v.Effective.RootCause)
|
||||
return cause == "" || cause == dashboardUnclearCause
|
||||
}
|
||||
|
||||
const dashboardUnclearCause = "结果不清"
|
||||
|
||||
func dashboardCalendarMonths(records []dashboardTimedQuality, end, now time.Time) []DashboardMonth {
|
||||
out := []DashboardMonth{}
|
||||
cutoff := end
|
||||
|
||||
Reference in New Issue
Block a user