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