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): def __str__(self):
return self.account.__str__() 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: class Meta:
model = ChangeSecretRecord model = ChangeSecretRecord
fields = [ fields = [
'id', 'asset', 'account', 'date_started', 'id', 'asset', 'account', 'date_started', 'date_finished',
'date_finished', 'is_success', 'error', 'execution', 'timedelta', 'is_success', 'error', 'execution',
] ]
read_only_fields = fields read_only_fields = fields

Loading…
Cancel
Save