From db818f35db23984943cab35010ee5ac95a6c183b Mon Sep 17 00:00:00 2001 From: Chandrasekharan M <117059509+chandrasekharan-zipstack@users.noreply.github.com> Date: Sat, 31 Aug 2024 11:40:49 +0530 Subject: [PATCH] fix: Allow pipeline enable / disable done through PATCH calls (#636) Regression fix: Allow pipeline enable / disable done through PATCH calls --- backend/pipeline/serializers/crud.py | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/backend/pipeline/serializers/crud.py b/backend/pipeline/serializers/crud.py index e14c909a3..8278d0fa2 100644 --- a/backend/pipeline/serializers/crud.py +++ b/backend/pipeline/serializers/crud.py @@ -89,10 +89,11 @@ def create(self, validated_data: dict[str, Any]) -> Any: return super().create(validated_data) def save(self, **kwargs: Any) -> Pipeline: - if self.validated_data[PK.CRON_STRING]: - self.validated_data[PK.SCHEDULED] = True - else: - self.validated_data[PK.SCHEDULED] = False + if PK.CRON_STRING in self.validated_data: + if self.validated_data[PK.CRON_STRING]: + self.validated_data[PK.SCHEDULED] = True + else: + self.validated_data[PK.SCHEDULED] = False pipeline: Pipeline = super().save(**kwargs) if pipeline.cron_string is None: SchedulerHelper.remove_job(pipeline_id=str(pipeline.id))