Bug on Format date
This commit is contained in:
@@ -138,18 +138,9 @@ func (wfa *workflowMongoAccessor) book(id string, realData *Workflow, execs []*w
|
||||
}
|
||||
|
||||
func (wfa *workflowMongoAccessor) execution(id string, realData *Workflow, delete bool) (int, error) {
|
||||
if realData.Schedule == nil {
|
||||
realData.ScheduleActive = false
|
||||
return 200, nil
|
||||
}
|
||||
var err error
|
||||
nats := tools.NewNATSCaller()
|
||||
res, code, _ := wfa.LoadOne(id)
|
||||
if code != 200 {
|
||||
return 404, errors.New("could not load workflow")
|
||||
}
|
||||
r := res.(*Workflow)
|
||||
if r.Schedule != nil && !realData.ScheduleActive {
|
||||
if realData.Schedule != nil && !realData.ScheduleActive {
|
||||
mongo.MONGOService.DeleteMultiple(map[string]interface{}{
|
||||
"state": 1,
|
||||
"workflow_id": id,
|
||||
@@ -158,14 +149,6 @@ func (wfa *workflowMongoAccessor) execution(id string, realData *Workflow, delet
|
||||
nats.SetNATSPub(utils.WORKFLOW.String(), tools.REMOVE, realData)
|
||||
return 200, err
|
||||
}
|
||||
if r.Schedule != nil {
|
||||
if r.Schedule.Start != nil && realData.Schedule.Start != nil && (r.Schedule.Start.Equal(*realData.Schedule.Start) || r.Schedule.Start.After(*realData.Schedule.Start)) {
|
||||
return 200, nil
|
||||
}
|
||||
if r.Schedule.Start == realData.Schedule.Start && r.Schedule.End == realData.Schedule.End && r.Schedule.Cron == realData.Schedule.Cron {
|
||||
return 200, nil
|
||||
}
|
||||
}
|
||||
accessor := (&workflow_execution.WorkflowExecution{}).GetAccessor(nil)
|
||||
execs, err := wfa.getExecutions(id, realData)
|
||||
if err != nil {
|
||||
@@ -197,13 +180,16 @@ func (wfa *workflowMongoAccessor) execution(id string, realData *Workflow, delet
|
||||
}
|
||||
|
||||
func (wfa *workflowMongoAccessor) UpdateOne(set utils.DBObject, id string) (utils.DBObject, int, error) {
|
||||
if code, err := wfa.execution(id, set.(*Workflow), true); err != nil {
|
||||
return nil, code, err
|
||||
}
|
||||
res, code, err := wfa.GenericUpdateOne(set, id, wfa, &Workflow{})
|
||||
if code != 200 {
|
||||
return nil, code, err
|
||||
}
|
||||
avoid := set.(*Workflow).Schedule == nil || (res.(*Workflow).Schedule != nil && res.(*Workflow).Schedule.Start == set.(*Workflow).Schedule.Start && res.(*Workflow).Schedule.End == set.(*Workflow).Schedule.End && res.(*Workflow).Schedule.Cron == set.(*Workflow).Schedule.Cron)
|
||||
if !avoid {
|
||||
if code, err := wfa.execution(id, res.(*Workflow), true); err != nil {
|
||||
return nil, code, err
|
||||
}
|
||||
}
|
||||
wfa.execute(res.(*Workflow))
|
||||
return res, code, err
|
||||
}
|
||||
|
Reference in New Issue
Block a user