diff --git a/apps/audits/serializers.py b/apps/audits/serializers.py index 594537612..b9d41f8e5 100644 --- a/apps/audits/serializers.py +++ b/apps/audits/serializers.py @@ -37,6 +37,7 @@ class JobLogSerializer(JobExecutionSerializer): class JobsAuditSerializer(JobSerializer): material = serializers.ReadOnlyField(label=_("Command")) summary = serializers.ReadOnlyField(label=_("Summary")) + crontab = serializers.ReadOnlyField(label=_("Execution cycle")) class Meta(JobSerializer.Meta): read_only_fields = [ diff --git a/apps/ops/models/job.py b/apps/ops/models/job.py index 433f4158d..28169afd9 100644 --- a/apps/ops/models/job.py +++ b/apps/ops/models/job.py @@ -181,13 +181,9 @@ class Job(JMSOrgBaseModel, PeriodTaskModelMixin): @property def summary(self): summary = { - "total": 0, - "success": 0, + "total": self.executions.count(), + "success": self.executions.filter(status=JobStatus.success).count(), } - for execution in self.executions.all(): - summary["total"] += 1 - if execution.is_success: - summary["success"] += 1 return summary @property