fix: mlogbw defect 分配 bug

This commit is contained in:
caoqianming 2025-10-22 15:57:08 +08:00
parent 241df0beca
commit 54999cce73
1 changed files with 1 additions and 1 deletions

View File

@ -535,6 +535,7 @@ class Mlogbw(BaseModel):
defect_ids = defect_ids.union(tqs_has_a.values_list("defect", flat=True))
defects = {defect.id: defect for defect in Defect.objects.filter(id__in=defect_ids)}
md_ids = []
MlogbDefect.objects.filter(mlogb=mlogb).delete()
for t in tqs_a:
md, _ = MlogbDefect.objects.get_or_create(mlogb=mlogb, defect=defects[t["ftest__defect_main"]])
md.count = t["xcount"]
@ -550,7 +551,6 @@ class Mlogbw(BaseModel):
md.save()
md_ids.append(md.id)
MlogbDefect.objects.filter(mlogb=mlogb).exclude(id__in=md_ids).delete()
mlogb.count_notok = count_notok
mlogb.count_ok = count - mlogb.count_notok
mlogb.count_ok_full = count - count_notok_full