Browse Source

perf: change secret timedelta

pull/8928/head
feng 2 years ago
parent
commit
94526e44f1
  1. 6
      apps/assets/models/automations/change_secret.py
  2. 4
      apps/assets/serializers/automations/change_secret.py

6
apps/assets/models/automations/change_secret.py

@ -65,3 +65,9 @@ class ChangeSecretRecord(JMSBaseModel):
def __str__(self):
return self.account.__str__()
@property
def timedelta(self):
if self.date_started and self.date_finished:
return self.date_finished - self.date_started
return None

4
apps/assets/serializers/automations/change_secret.py

@ -93,8 +93,8 @@ class ChangeSecretRecordSerializer(serializers.ModelSerializer):
class Meta:
model = ChangeSecretRecord
fields = [
'id', 'asset', 'account', 'date_started',
'date_finished', 'is_success', 'error', 'execution',
'id', 'asset', 'account', 'date_started', 'date_finished',
'timedelta', 'is_success', 'error', 'execution',
]
read_only_fields = fields

Loading…
Cancel
Save