fix: sflog展示run_hour

This commit is contained in:
caoqianming 2024-05-17 09:16:45 +08:00
parent 32c1647b9b
commit 617013f299
1 changed files with 1 additions and 1 deletions

View File

@ -140,7 +140,7 @@ class SfLogSerializer(CustomModelSerializer):
def to_representation(self, instance):
ret = super().to_representation(instance)
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
# def to_internal_value(self, data):
# if hasattr(self.Meta, 'update_fields') and self.context['request'].method in ['PUT', 'PATCH']: