Bug on Format date
This commit is contained in:
@@ -38,7 +38,7 @@ type Workflow struct {
|
||||
AbstractWorkflow
|
||||
}
|
||||
|
||||
func (wfa *Workflow) CheckBooking(subPath string) (bool, error) {
|
||||
func (wfa *Workflow) CheckBooking(subPath string, caller *tools.HTTPCaller) (bool, error) {
|
||||
// check if
|
||||
if wfa.Schedule == nil || wfa.Schedule.Start == nil || wfa.Graph == nil {
|
||||
return false, nil
|
||||
@@ -64,22 +64,12 @@ func (wfa *Workflow) CheckBooking(subPath string) (bool, error) {
|
||||
if code != 200 {
|
||||
return false, err
|
||||
}
|
||||
caller := tools.NewHTTPCaller(map[string]map[tools.METHOD]string{})
|
||||
if strings.Contains(p.(*peer.Peer).Url, "localhost") || strings.Contains(p.(*peer.Peer).Url, "127.0.0.1") {
|
||||
subPath = strings.ReplaceAll(subPath, "localhost", utils.BOOKING.API())
|
||||
subPath = strings.ReplaceAll(subPath, "127.0.0.1", utils.BOOKING.API())
|
||||
}
|
||||
subPath = strings.ReplaceAll(subPath, ":start_date", wfa.getFormat(wfa.Schedule.Start))
|
||||
subPath = strings.ReplaceAll(subPath, ":end_date", wfa.getFormat(&e))
|
||||
resp, err := caller.CallGet(p.(*peer.Peer).Url, subPath)
|
||||
_, err = p.(*peer.Peer).LaunchPeerExecution(peerID, "", p.(*peer.Peer).Url, utils.BOOKING, tools.POST, nil, caller)
|
||||
if err != nil {
|
||||
return false, err
|
||||
}
|
||||
var response map[string]interface{}
|
||||
json.Unmarshal(resp, &response)
|
||||
if code, ok := response["code"]; ok && code != 200 {
|
||||
return false, errors.New(fmt.Sprintf("%v", response["error"]))
|
||||
}
|
||||
}
|
||||
}
|
||||
return true, nil
|
||||
|
Reference in New Issue
Block a user