From cf571cea1ca1a61e3968f1111a30a1f7d34944c8 Mon Sep 17 00:00:00 2001 From: Ruben Fiszel Date: Fri, 1 Mar 2024 21:25:25 +0100 Subject: [PATCH] fix schedule creator --- .../src/lib/components/ScriptBuilder.svelte | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/frontend/src/lib/components/ScriptBuilder.svelte b/frontend/src/lib/components/ScriptBuilder.svelte index 6785c3aef0..829c35622c 100644 --- a/frontend/src/lib/components/ScriptBuilder.svelte +++ b/frontend/src/lib/components/ScriptBuilder.svelte @@ -260,18 +260,15 @@ }) const { enabled, timezone, args, cron, summary } = $scheduleStore - const scheduleExists = - initialPath && - initialPath != '' && - (await ScheduleService.existsSchedule({ - workspace: $workspaceStore ?? '', - path: initialPath - })) + const scheduleExists = await ScheduleService.existsSchedule({ + workspace: $workspaceStore ?? '', + path: script.path + }) if (scheduleExists) { const schedule = await ScheduleService.getSchedule({ workspace: $workspaceStore ?? '', - path: initialPath + path: script.path }) if ( JSON.stringify(schedule.args) != JSON.stringify(args) || @@ -281,7 +278,7 @@ ) { await ScheduleService.updateSchedule({ workspace: $workspaceStore ?? '', - path: initialPath, + path: script.path, requestBody: { schedule: formatCron(cron), timezone, @@ -293,12 +290,12 @@ if (enabled != schedule.enabled) { await ScheduleService.setScheduleEnabled({ workspace: $workspaceStore ?? '', - path: initialPath, + path: script.path, requestBody: { enabled } }) } } else if (enabled) { - await createSchedule(initialPath) + await createSchedule(script.path) } savedScript = cloneDeep(script) as NewScriptWithDraft