Compare commits
	
		
			2 Commits
		
	
	
		
			4f0ab6a376
			...
			754925c32c
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					754925c32c | ||
| 
						 | 
					4956166f76 | 
@@ -2,6 +2,7 @@ package workflow
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"errors"
 | 
			
		||||
	"fmt"
 | 
			
		||||
	"strings"
 | 
			
		||||
 | 
			
		||||
	"cloud.o-forge.io/core/oc-lib/dbs"
 | 
			
		||||
@@ -197,7 +198,10 @@ func (wfa *workflowMongoAccessor) execution(id string, realData *Workflow, delet
 | 
			
		||||
		}, utils.WORKFLOW_EXECUTION.String())
 | 
			
		||||
		err := wfa.book(id, realData, []*workflow_execution.WorkflowExecution{}) // delete the booking of the workflow on the peers
 | 
			
		||||
		nats.SetNATSPub(utils.WORKFLOW.String(), tools.REMOVE, realData)         // send the deletion to the nats
 | 
			
		||||
		return 200, err
 | 
			
		||||
		if err != nil {
 | 
			
		||||
			return 409, err
 | 
			
		||||
		}
 | 
			
		||||
		return 200, nil
 | 
			
		||||
	}
 | 
			
		||||
	accessor := (&workflow_execution.WorkflowExecution{}).GetAccessor(nil)
 | 
			
		||||
	execs, err := wfa.getExecutions(id, realData) // get the executions of the workflow
 | 
			
		||||
@@ -240,11 +244,13 @@ 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(code, err)
 | 
			
		||||
	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), true); err != nil {
 | 
			
		||||
		if code, err := wfa.execution(id, res.(*Workflow), true); code != 200 {
 | 
			
		||||
			fmt.Println(code, err)
 | 
			
		||||
			return nil, code, err
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user