feat: mpointstat total_production<1时分布电耗为0
This commit is contained in:
parent
75b2a420b7
commit
860d2b5626
|
|
@ -131,6 +131,8 @@ class MpointStatSerializer(CustomModelSerializer):
|
||||||
|
|
||||||
def to_representation(self, instance):
|
def to_representation(self, instance):
|
||||||
ret = super().to_representation(instance)
|
ret = super().to_representation(instance)
|
||||||
|
if "total_production" in ret and ret["total_production"] < 1:
|
||||||
|
ret["elec_consume_unit"] = 0
|
||||||
my_dic_keys = list(ret.keys())
|
my_dic_keys = list(ret.keys())
|
||||||
for key in my_dic_keys:
|
for key in my_dic_keys:
|
||||||
ret_one_val = ret[key]
|
ret_one_val = ret[key]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue