diff --git a/models/workflow/workflow_mongo_accessor.go b/models/workflow/workflow_mongo_accessor.go index 08645a9..9f67d33 100644 --- a/models/workflow/workflow_mongo_accessor.go +++ b/models/workflow/workflow_mongo_accessor.go @@ -348,14 +348,18 @@ func (wfa *workflowMongoAccessor) LoadOne(id string) (utils.DBObject, int, error return nil, code, err } res_mongo.Decode(&workflow) + found := false if workflow.ScheduleActive && workflow.Schedule != nil { // if the workflow is scheduled, update the executions now := time.Now().UTC() if (workflow.Schedule.End != nil && now.After(*workflow.Schedule.End)) || (workflow.Schedule.End == nil && workflow.Schedule.Start != nil && now.After(*workflow.Schedule.Start)) { // if the start date is passed, then you can book workflow.ScheduleActive = false - wfa.GenericRawUpdateOne(&workflow, id, wfa) + found = true } // if the start date is passed, update the executions } wfa.execute(&workflow, false, true) // if no workspace is attached to the workflow, create it + if found { + wfa.GenericRawUpdateOne(&workflow, id, wfa) + } return &workflow, 200, nil }