feat: norecord时num_pt_10 也为0

This commit is contained in:
caoqianming 2023-06-01 13:45:41 +08:00
parent f5e237b635
commit a7d2c4f8c4
1 changed files with 6 additions and 1 deletions

View File

@ -522,9 +522,14 @@ class Task2DoViewSet(ListModelMixin, GenericViewSet):
没有记录 没有记录
""" """
obj = self.get_object() obj = self.get_object()
theattr = getattr(obj, request.data.get('key'), None) field = request.data.get('key')
theattr = getattr(obj, field, None)
if theattr is None: if theattr is None:
theattr = 0 theattr = 0
if field == 'num_complaint':
obj.num_complaint_10 = 0
elif field == 'num_pt':
obj.num_pt_10 = 0
else: else:
raise ParseError('已有记录') raise ParseError('已有记录')
obj.save() obj.save()