From 4a3707efcf3b7748f208144679de9002e1ffe4cc Mon Sep 17 00:00:00 2001 From: mr Date: Wed, 28 Aug 2024 14:44:56 +0200 Subject: [PATCH 1/2] correct workflow problem --- models/workspace/workspace_mongo_accessor.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/models/workspace/workspace_mongo_accessor.go b/models/workspace/workspace_mongo_accessor.go index 9d6f744..4a5fbbe 100644 --- a/models/workspace/workspace_mongo_accessor.go +++ b/models/workspace/workspace_mongo_accessor.go @@ -26,10 +26,6 @@ func (wfa *workspaceMongoAccessor) DeleteOne(id string) (utils.DBObject, int, er } func (wfa *workspaceMongoAccessor) UpdateOne(set utils.DBObject, id string) (utils.DBObject, int, error) { - res, _, err := wfa.Search(nil, set.GetName()) - if err == nil && len(res) > 0 { - return nil, 409, errors.New("A workspace with the same name already exists") - } d := set.(*Workspace) d.DataResources = nil d.DatacenterResources = nil @@ -51,6 +47,10 @@ func (wfa *workspaceMongoAccessor) UpdateOne(set utils.DBObject, id string) (uti } func (wfa *workspaceMongoAccessor) StoreOne(data utils.DBObject) (utils.DBObject, int, error) { + res, _, err := wfa.Search(nil, data.GetName()) + if err == nil && len(res) > 0 { + return nil, 409, errors.New("A workspace with the same name already exists") + } d := data.(*Workspace) d.DataResources = nil d.DatacenterResources = nil From 4a9465f729f2ef7423c6cf4e33b5deabf842e228 Mon Sep 17 00:00:00 2001 From: pb Date: Wed, 28 Aug 2024 15:12:42 +0200 Subject: [PATCH 2/2] typo --- models/workflow/workflow_mongo_accessor.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/models/workflow/workflow_mongo_accessor.go b/models/workflow/workflow_mongo_accessor.go index a3604d2..eaa3f1f 100644 --- a/models/workflow/workflow_mongo_accessor.go +++ b/models/workflow/workflow_mongo_accessor.go @@ -36,7 +36,7 @@ func (wfa *workflowMongoAccessor) getExecutions(id string, data *Workflow) ([]*w } if len(data.Schedule.Cron) > 0 { if data.Schedule.End == nil { - return workflows_execution, errors.New("a cron task should got a end date.") + return workflows_execution, errors.New("a cron task should have an end date.") } cronStr := strings.Split(data.Schedule.Cron, " ") if len(cronStr) < 6 {