fix: mpointserializer validate 时不做mgroup绑定allocate处理2
This commit is contained in:
parent
4157fd95a8
commit
5cfb12113e
|
@ -29,11 +29,12 @@ class MpointSerializer(CustomModelSerializer):
|
|||
ratio_ = 0
|
||||
mgroupIds = []
|
||||
for i in attrs['mgroups_allocate']:
|
||||
ratio_ = ratio_ + i['ratio']
|
||||
if i['mgroup'] in mgroupIds:
|
||||
raise ParseError('分配集错误')
|
||||
mgroupIds.append(i['mgroup'])
|
||||
i['mgroup_name'] = Mgroup.objects.get(id=i['mgroup']).name
|
||||
if i['mgroup']:
|
||||
ratio_ = ratio_ + i['ratio']
|
||||
if i['mgroup'] in mgroupIds:
|
||||
raise ParseError('分配集错误')
|
||||
mgroupIds.append(i['mgroup'])
|
||||
i['mgroup_name'] = Mgroup.objects.get(id=i['mgroup']).name
|
||||
if attrs['mgroups_allocate'] and round(ratio_, 3) != 1.0:
|
||||
raise ParseError('比例合计错误')
|
||||
return attrs
|
||||
|
|
Loading…
Reference in New Issue