diff --git a/models/booking/booking_mongo_accessor.go b/models/booking/booking_mongo_accessor.go index f994c90..7625fe7 100644 --- a/models/booking/booking_mongo_accessor.go +++ b/models/booking/booking_mongo_accessor.go @@ -1,9 +1,12 @@ package booking import ( + "time" + "cloud.o-forge.io/core/oc-lib/dbs" "cloud.o-forge.io/core/oc-lib/dbs/mongo" "cloud.o-forge.io/core/oc-lib/models/utils" + "cloud.o-forge.io/core/oc-lib/models/workflow_execution" ) type bookingMongoAccessor struct { @@ -42,6 +45,10 @@ func (wfa *bookingMongoAccessor) LoadOne(id string) (utils.DBObject, int, error) return nil, code, err } res_mongo.Decode(&workflow) + if workflow.State == workflow_execution.SCHEDULED && time.Now().UTC().After(*workflow.ExecDate) { + workflow.State = workflow_execution.FORGOTTEN + wfa.GenericRawUpdateOne(&workflow, id, wfa) + } return &workflow, 200, nil } diff --git a/models/workflow_execution/workflow_execution_mongo_accessor.go b/models/workflow_execution/workflow_execution_mongo_accessor.go index 7806046..5a77255 100644 --- a/models/workflow_execution/workflow_execution_mongo_accessor.go +++ b/models/workflow_execution/workflow_execution_mongo_accessor.go @@ -1,7 +1,6 @@ package workflow_execution import ( - "fmt" "time" "cloud.o-forge.io/core/oc-lib/dbs" @@ -41,7 +40,6 @@ func (wfa *workflowExecutionMongoAccessor) LoadOne(id string) (utils.DBObject, i return nil, code, err } res_mongo.Decode(&workflow) - fmt.Println("workflow: ", workflow.State, time.Now().UTC().After(*workflow.ExecDate)) if workflow.State == SCHEDULED && time.Now().UTC().After(*workflow.ExecDate) { workflow.State = FORGOTTEN wfa.GenericRawUpdateOne(&workflow, id, wfa)