correct is DC link

This commit is contained in:
mr 2024-08-20 15:31:25 +02:00
parent bfbcd58d1b
commit d13249d87d

View File

@ -140,7 +140,14 @@ func (wfa *workflowMongoAccessor) book(id string, realData *Workflow, execs []*w
func (wfa *workflowMongoAccessor) execution(id string, realData *Workflow, delete bool) (int, error) { func (wfa *workflowMongoAccessor) execution(id string, realData *Workflow, delete bool) (int, error) {
if realData.Schedule == nil && realData.ScheduleActive { if realData.Schedule == nil && realData.ScheduleActive {
return 200, nil res, code, err := wfa.LoadOne(id)
if code == 200 {
r := res.(*Workflow)
if r.Schedule != nil {
err = wfa.book(id, r, []*workflow_execution.WorkflowExecution{})
}
}
return 200, err
} }
if realData.Schedule == nil && !realData.ScheduleActive { if realData.Schedule == nil && !realData.ScheduleActive {
mongo.MONGOService.DeleteMultiple(map[string]interface{}{ mongo.MONGOService.DeleteMultiple(map[string]interface{}{
@ -150,7 +157,10 @@ func (wfa *workflowMongoAccessor) execution(id string, realData *Workflow, delet
err := wfa.book(id, realData, []*workflow_execution.WorkflowExecution{}) err := wfa.book(id, realData, []*workflow_execution.WorkflowExecution{})
return 200, err return 200, err
} }
res, _, _ := wfa.LoadOne(id) res, code, _ := wfa.LoadOne(id)
if code != 200 {
return 404, errors.New("could not load workflow")
}
r := res.(*Workflow) r := res.(*Workflow)
if r.Schedule != nil && r.Schedule.Start == realData.Schedule.Start && r.Schedule.End == realData.Schedule.End && r.Schedule.Cron == realData.Schedule.Cron { if r.Schedule != nil && r.Schedule.Start == realData.Schedule.Start && r.Schedule.End == realData.Schedule.End && r.Schedule.Cron == realData.Schedule.Cron {
return 200, nil return 200, nil