From 2a8d03f01b15385a8dab21792c76b305b440fe7d Mon Sep 17 00:00:00 2001 From: Chris Anderson Date: Fri, 27 Sep 2024 22:37:29 -0500 Subject: [PATCH] Fixes journey next scheduled date reset (#509) --- apps/platform/src/journey/JourneyRepository.ts | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/apps/platform/src/journey/JourneyRepository.ts b/apps/platform/src/journey/JourneyRepository.ts index fe28f5f7..6b3556a9 100644 --- a/apps/platform/src/journey/JourneyRepository.ts +++ b/apps/platform/src/journey/JourneyRepository.ts @@ -124,10 +124,12 @@ export const setJourneyStepMap = async (journeyId: number, stepMap: JourneyStepM steps.push(step = new JourneyStep()) } let next_scheduled_at: null | Date = null - if (type === JourneyEntrance.type - && data.trigger === 'schedule' - && step.data?.schedule !== data.schedule) { - next_scheduled_at = JourneyEntrance.fromJson({ data }).nextDate(now) + if (type === JourneyEntrance.type && data.trigger === 'schedule') { + if (step.data?.schedule !== data.schedule) { + next_scheduled_at = JourneyEntrance.fromJson({ data }).nextDate(now) + } else { + next_scheduled_at = step.next_scheduled_at + } } const fields = { data, data_key, name, next_scheduled_at, x, y } step.parseJson(step.id