fix: sflog展示run_hour
This commit is contained in:
parent
32c1647b9b
commit
617013f299
|
@ -140,7 +140,7 @@ class SfLogSerializer(CustomModelSerializer):
|
||||||
def to_representation(self, instance):
|
def to_representation(self, instance):
|
||||||
ret = super().to_representation(instance)
|
ret = super().to_representation(instance)
|
||||||
if "shut_sec" in ret:
|
if "shut_sec" in ret:
|
||||||
ret["shut_sec"] = "{:.2f}".format(round(ret['run_sec']/3600, 2))
|
ret["shut_hour"] = "{:.2f}".format(round(ret['shut_sec']/3600, 2))
|
||||||
return ret
|
return ret
|
||||||
# def to_internal_value(self, data):
|
# def to_internal_value(self, data):
|
||||||
# if hasattr(self.Meta, 'update_fields') and self.context['request'].method in ['PUT', 'PATCH']:
|
# if hasattr(self.Meta, 'update_fields') and self.context['request'].method in ['PUT', 'PATCH']:
|
||||||
|
|
Loading…
Reference in New Issue