diff --git a/models/workspace/workspace_mongo_accessor.go b/models/workspace/workspace_mongo_accessor.go index c5685c6..1ecce05 100644 --- a/models/workspace/workspace_mongo_accessor.go +++ b/models/workspace/workspace_mongo_accessor.go @@ -50,9 +50,14 @@ func (wfa *WorkspaceMongoAccessor) LoadOne(id string) (utils.DBObject, int, erro return nil, code, err } res_mongo.Decode(&workflow) - obj := &Workspace{Active: false} - mongo.MONGOService.UpdateMultiple(obj, map[string]interface{}{"active": true}, wfa.GetType()) - obj = &Workspace{Active: true} + results, _, err := wfa.LoadAll() + if err == nil && len(results) > 0 { + for _, r := range results { + r.(*Workspace).Active = false + wfa.UpdateOne(&Workspace{Active: false}, r.GetID()) + } + } + obj := &Workspace{Active: true} wfa.UpdateOne(obj, id) if workflow.Datas != nil && len(workflow.Datas) > 0 {