debug automation workspace

This commit is contained in:
mr 2024-07-31 08:36:16 +02:00
parent 18d54cdb8f
commit 19381d6438

View File

@ -25,6 +25,17 @@ func (wfa *WorkspaceMongoAccessor) UpdateOne(set utils.DBObject, id string) (uti
d.StorageResources = nil d.StorageResources = nil
d.ProcessingResources = nil d.ProcessingResources = nil
d.WorkflowResources = nil d.WorkflowResources = nil
if d.Active {
res, _, err := wfa.LoadAll()
if err == nil {
for _, r := range res {
if r.GetID() != id {
r.(*Workspace).Active = false
wfa.UpdateOne(r.(*Workspace), r.GetID())
}
}
}
}
return wfa.GenericUpdateOne(set, id, wfa, &Workspace{}) return wfa.GenericUpdateOne(set, id, wfa, &Workspace{})
} }
@ -50,13 +61,7 @@ func (wfa *WorkspaceMongoAccessor) LoadOne(id string) (utils.DBObject, int, erro
return nil, code, err return nil, code, err
} }
res_mongo.Decode(&workflow) res_mongo.Decode(&workflow)
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} obj := &Workspace{Active: true}
wfa.UpdateOne(obj, id) wfa.UpdateOne(obj, id)