fix: init_test bug

This commit is contained in:
caoqianming 2023-08-02 10:51:48 +08:00
parent 6fa1d379d3
commit ad2f903c89
1 changed files with 1 additions and 2 deletions

View File

@ -75,8 +75,7 @@ class SfLogViewSet(UpdateModelMixin, ListModelMixin, DestroyModelMixin, CustomGe
testitems = TestItem.objects.filter(id__in=material.testitems).order_by('sort', '-create_time')
for testitem in testitems:
params = {'material': material, 'testitem': testitem, 'sflog': obj}
params_default = params.update({'create_by': request.user, 'belong_dept': obj.mgroup.belong_dept})
QuaStat.objects.get_or_create(**params, defaults=params_default)
QuaStat.objects.get_or_create(**params, defaults={**params, **{'create_by': request.user, 'belong_dept': obj.mgroup.belong_dept}})
qs = QuaStat.objects.filter(sflog=obj).order_by('material__sort', 'material__create_time', 'testitem__sort', 'testitem__create_time')
sr = QuaStatSerializer(instance=qs, many=True)
return Response(sr.data)