Files
knowledge-governance/internal/qaopsquality/master.go
T
姚章浩 87f97a2f9b
build / build (push) Successful in 1m7s
feat(qaops): 完成详情下拉与每周自动保存草稿
详情使用共享主表字典,稀疏修改所选字段并保留原始问答及旧复核审计。
月周统计提供文本和下拉双入口;每租户每周一份持久草稿,按技能六节双语模板真实预填。
加入幂等自动保存、冲突保留、未知响应重试、切周及离开保护和schema58非破坏降级保护。

验证:完整make verify、隔离PostgreSQL全mirror竞态回归、真实恢复库浏览器验收通过。
浏览器实测字段精确读回、月周双输入、模板预填、MD/CSV、自动保存、冲突、失败重试与API重启恢复。
未连接或改写DobotAI生产源库,未运行付费模型;提交时尚未部署。
2026-10-20 05:44:02 +08:00

56 lines
2.0 KiB
Go

package qaopsquality
import "knowledge-governance/internal/dobotaiops"
func ProjectMasterWithEdits(v View, stored map[string]string, derived dobotaiops.CoverageCheck, edits map[string]string) View {
v = ProjectMaster(v, stored, derived)
if value, ok := edits["coverage"]; ok {
v.Effective.Coverage = map[string]string{"是": "covered", "否": "uncovered", "否但不计入": "excluded"}[value]
v.Effective.ExclusionReason = ""
if value == "否但不计入" {
v.Effective.ExclusionReason = "详情字段选择:否但不计入"
}
}
if value, ok := edits["is_correct"]; ok {
v.Effective.Correctness = map[string]string{"是": "correct", "否": "incorrect", "待确认": "pending"}[value]
}
if value, ok := edits["product_category"]; ok {
v.Effective.ProductCategory = value
}
if value, ok := edits["problem_type"]; ok {
v.Effective.ProblemType = value
}
if value, ok := edits["root_cause"]; ok {
v.Effective.RootCause = value
}
if v.Effective.Correctness == "correct" {
v.Effective.RootCause = ""
}
return v
}
// Stored master labels remain their original provenance, not synthetic reviews.
func ProjectMaster(v View, stored map[string]string, derived dobotaiops.CoverageCheck) View {
v.EffectiveSource = "master-effective-fields-v1"
if v.State != "reviewed" {
v.Effective.Coverage = map[string]string{"是": "covered", "否": "uncovered", "部分覆盖": "partial", "待确认": "pending"}[stored["coverage"]]
if v.Effective.Coverage == "" {
v.Effective.Coverage = derived.Verdict
}
v.Effective.Correctness = map[string]string{"是": "correct", "否": "incorrect", "待确认": "pending"}[stored["is_correct"]]
}
if v.Effective.ProductCategory == "" {
v.Effective.ProductCategory = stored["product_category"]
}
if v.Effective.ProblemType == "" {
v.Effective.ProblemType = stored["problem_type"]
}
if v.Effective.RootCause == "" && v.Effective.Correctness != "correct" {
v.Effective.RootCause = stored["root_cause"]
}
if v.Effective.Correctness == "correct" {
v.Effective.RootCause = ""
}
return v
}