feat: sflog展示run_hour
This commit is contained in:
parent
bd33a33ed6
commit
32c1647b9b
|
@ -136,6 +136,12 @@ class SfLogSerializer(CustomModelSerializer):
|
||||||
if mgroup.need_enm:
|
if mgroup.need_enm:
|
||||||
cal_enstat_when_team_change.delay(instance.id)
|
cal_enstat_when_team_change.delay(instance.id)
|
||||||
return instance
|
return instance
|
||||||
|
|
||||||
|
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))
|
||||||
|
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']:
|
||||||
# u_fields = self.Meta.update_fields
|
# u_fields = self.Meta.update_fields
|
||||||
|
|
Loading…
Reference in New Issue