test booking
This commit is contained in:
		@@ -240,13 +240,11 @@ func (wfa *workflowMongoAccessor) UpdateOne(set utils.DBObject, id string) (util
 | 
			
		||||
	// avoid the update if the schedule is the same
 | 
			
		||||
	avoid := set.(*Workflow).Schedule == nil || (res.(*Workflow).Schedule != nil && res.(*Workflow).ScheduleActive == set.(*Workflow).ScheduleActive && res.(*Workflow).Schedule.Start == set.(*Workflow).Schedule.Start && res.(*Workflow).Schedule.End == set.(*Workflow).Schedule.End && res.(*Workflow).Schedule.Cron == set.(*Workflow).Schedule.Cron)
 | 
			
		||||
	res, code, err = wfa.GenericUpdateOne(set, id, wfa, &Workflow{})
 | 
			
		||||
	fmt.Println("UPDATE", code, err, avoid)
 | 
			
		||||
	if code != 200 {
 | 
			
		||||
		return nil, code, err
 | 
			
		||||
	}
 | 
			
		||||
	if !avoid { // if the schedule is not avoided, update the executions
 | 
			
		||||
		if code, err := wfa.execution(id, res.(*Workflow), false); code != 200 {
 | 
			
		||||
			fmt.Println("TEST", code, err)
 | 
			
		||||
			return nil, code, errors.New("could not update the executions : " + err.Error())
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
@@ -280,6 +278,7 @@ func (wfa *workflowMongoAccessor) CopyOne(data utils.DBObject) (utils.DBObject,
 | 
			
		||||
func (wfa *workflowMongoAccessor) execute(workflow *Workflow, delete bool, active bool) {
 | 
			
		||||
 | 
			
		||||
	accessor := (&workspace.Workspace{}).GetAccessor(nil)
 | 
			
		||||
	fmt.Println("DEL", workflow.Name+"_workspace", delete)
 | 
			
		||||
	filters := &dbs.Filters{
 | 
			
		||||
		Or: map[string][]dbs.Filter{ // filter by standard workspace name attached to a workflow
 | 
			
		||||
			"abstractobject.name": {{dbs.LIKE.String(), workflow.Name + "_workspace"}},
 | 
			
		||||
@@ -288,7 +287,8 @@ func (wfa *workflowMongoAccessor) execute(workflow *Workflow, delete bool, activ
 | 
			
		||||
	resource, _, err := accessor.Search(filters, "")
 | 
			
		||||
	if delete { // if delete is set to true, delete the workspace
 | 
			
		||||
		for _, r := range resource {
 | 
			
		||||
			accessor.DeleteOne(r.GetID())
 | 
			
		||||
			rr, c, err := accessor.DeleteOne(r.GetID())
 | 
			
		||||
			fmt.Println("DEL", rr, c, err)
 | 
			
		||||
		}
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user