From ed4cb943a8caacb023d907c2678bc96e543d63d7 Mon Sep 17 00:00:00 2001 From: mr Date: Fri, 2 Aug 2024 11:04:18 +0200 Subject: [PATCH] nil except --- models/workflow/workflow_mongo_accessor.go | 5 +++-- models/workspace/workspace.go | 3 ++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/models/workflow/workflow_mongo_accessor.go b/models/workflow/workflow_mongo_accessor.go index 63fbcc3..4d24e07 100644 --- a/models/workflow/workflow_mongo_accessor.go +++ b/models/workflow/workflow_mongo_accessor.go @@ -103,11 +103,12 @@ func (wfa *workflowMongoAccessor) execute(workflow *Workflow) { accessor := (&workspace.Workspace{}).GetAccessor() filters := &dbs.Filters{ Or: map[string]dbs.Filter{ - "abstractobject.name": {Operator: dbs.LIKE.String(), Value: workflow.Name + "_workspace"}, + "abstractobject.name": {dbs.LIKE.String(), workflow.Name + "_workspace"}, }, } resource, _, err := accessor.Search(filters, "") - if err == nil && len(resource) == 1 { + fmt.Println(resource) + if err == nil && len(resource) > 0 { accessor.UpdateOne(&workspace.Workspace{ Active: true, ResourceSet: resources.ResourceSet{ diff --git a/models/workspace/workspace.go b/models/workspace/workspace.go index 7f93775..a2aee5c 100644 --- a/models/workspace/workspace.go +++ b/models/workspace/workspace.go @@ -11,7 +11,8 @@ import ( type Workspace struct { utils.AbstractObject resources.ResourceSet - Active bool `json:"active" bson:"active" default:"false"` + IsContextual bool `json:"is_contextual" bson:"is_contextual" default:"false"` + Active bool `json:"active" bson:"active" default:"false"` } func (ao *Workspace) GetID() string {