feat: 优化mlogbw bulk update
This commit is contained in:
parent
c7514836cb
commit
fa7d3095de
|
@ -961,9 +961,20 @@ class MlogbwViewSet(CustomModelViewSet):
|
|||
@transaction.atomic
|
||||
def perform_update(self, serializer):
|
||||
mlogbw = serializer.save()
|
||||
Mlogbw.cal_count_notok(mlogbw.mlogb)
|
||||
mlog = mlogbw.mlogb.mlog
|
||||
mlog.cal_mlog_count_from_mlogb()
|
||||
if isinstance(mlogbw, list):
|
||||
pass
|
||||
else:
|
||||
Mlogbw.cal_count_notok(mlogbw.mlogb)
|
||||
mlog = mlogbw.mlogb.mlog
|
||||
mlog.cal_mlog_count_from_mlogb()
|
||||
|
||||
def after_bulk_update(self, objs):
|
||||
mlogbIds = list(set([obj.mlogb for obj in objs]))
|
||||
for mlogbId in mlogbIds:
|
||||
mlogbw = Mlogbw.objects.get(id=mlogbId)
|
||||
Mlogbw.cal_count_notok(mlogbw.mlogb)
|
||||
mlog = mlogbw.mlogb.mlog
|
||||
mlog.cal_mlog_count_from_mlogb()
|
||||
|
||||
@transaction.atomic
|
||||
def perform_destroy(self, instance:Mlogbw):
|
||||
|
|
Loading…
Reference in New Issue