Commit 59120863 authored by Roshan Patil's avatar Roshan Patil
Browse files

Merge branch 'Roshanp-NewMQLChanges' into CoreDev-BtoC

parents cf4c6f51 f5577c2b
1 merge request!68Core dev bto c
Showing with 24 additions and 20 deletions
...@@ -27,6 +27,7 @@ func dynamicFormEvalution(ab *servicebuildermdl.AbstractBusinessLogicHolder, rs ...@@ -27,6 +27,7 @@ func dynamicFormEvalution(ab *servicebuildermdl.AbstractBusinessLogicHolder, rs
if eval == nil { if eval == nil {
return nil, nil return nil, nil
} }
configs := rs.Get("conditions").Array() configs := rs.Get("conditions").Array()
if rs.String() == "" || len(configs) == 0 { if rs.String() == "" || len(configs) == 0 {
return nil, nil return nil, nil
...@@ -36,27 +37,24 @@ func dynamicFormEvalution(ab *servicebuildermdl.AbstractBusinessLogicHolder, rs ...@@ -36,27 +37,24 @@ func dynamicFormEvalution(ab *servicebuildermdl.AbstractBusinessLogicHolder, rs
loggermdl.LogError("No current page found") loggermdl.LogError("No current page found")
return nil, errormdl.Wrap("No current page found") return nil, errormdl.Wrap("No current page found")
} }
nextNoConditionPage := gjson.Result{}
currentPageIsNoCondition := false currentPageIndex := -1
isCurrentPageIsNC := false
isEndPage := false isEndPage := false
endPageObj := gjson.Result{} endPageObj := gjson.Result{}
for _, obj := range configs { for i, obj := range configs {
condition := obj.Get("condition").String() condition := obj.Get("condition").String()
pageID := obj.Get("pageID").String() pageID := obj.Get("pageID").String()
noCondition := obj.Get("noCondition").Bool() noCondition := obj.Get("noCondition").Bool()
if pageID == currentPage {
if noCondition { isEndPage = obj.Get("isEndPage").Bool()
if currentPageIsNoCondition { if isEndPage {
nextNoConditionPage = obj endPageObj = obj
currentPageIsNoCondition = false
} }
if pageID == currentPage { if noCondition {
currentPageIsNoCondition = true isCurrentPageIsNC = true
isEndPage = obj.Get("isEndPage").Bool()
if isEndPage {
endPageObj = obj
}
} }
currentPageIndex = i
continue continue
} }
var expr conditions.Expr var expr conditions.Expr
...@@ -95,10 +93,16 @@ func dynamicFormEvalution(ab *servicebuildermdl.AbstractBusinessLogicHolder, rs ...@@ -95,10 +93,16 @@ func dynamicFormEvalution(ab *servicebuildermdl.AbstractBusinessLogicHolder, rs
if isEndPage { if isEndPage {
return endPageObj.Value(), nil return endPageObj.Value(), nil
} }
if nextNoConditionPage.String() != "" {
return nextNoConditionPage.Value(), nil
}
for i, obj := range configs {
if isCurrentPageIsNC && i <= currentPageIndex {
continue
}
noCondition := obj.Get("noCondition").Bool()
if noCondition {
return obj.Value(), nil
}
}
ab.SetErrorCode(errormdl.NEXTFORMEVALERROR) ab.SetErrorCode(errormdl.NEXTFORMEVALERROR)
return nil, errormdl.Wrap("NO CONDITION MATCHED") return nil, errormdl.Wrap("NO CONDITION MATCHED")
} }
...@@ -68,7 +68,6 @@ func executeService(name string, data []byte, isForm bool, formData *multipart.F ...@@ -68,7 +68,6 @@ func executeService(name string, data []byte, isForm bool, formData *multipart.F
service, found = openServices.Get(name) service, found = openServices.Get(name)
} }
if !found { if !found {
// ab.SetErrorCode(errormdl.SERVICENOTFOUND)
loggermdl.LogError("Service Not Found: " + name) loggermdl.LogError("Service Not Found: " + name)
return nil, nextDynamicPage, ab, isCompressed, errormdl.SERVICENOTFOUND, errormdl.Wrap("Service Not Found: " + name) return nil, nextDynamicPage, ab, isCompressed, errormdl.SERVICENOTFOUND, errormdl.Wrap("Service Not Found: " + name)
} }
...@@ -138,10 +137,11 @@ func commonHandler(c *gin.Context, isRestricted, isRoleBased bool, principalObj ...@@ -138,10 +137,11 @@ func commonHandler(c *gin.Context, isRestricted, isRoleBased bool, principalObj
if errormdl.CheckErr1(err) != nil { if errormdl.CheckErr1(err) != nil {
if ab == nil { if ab == nil {
responseDataObj.ErrorCode = errorCode responseDataObj.ErrorCode = errorCode
responseDataObj.Error = err.Error()
} else { } else {
responseDataObj.Error = ab.GetErrorData() responseDataObj.Error = ab.GetErrorData()
if responseDataObj.Error == nil { if responseDataObj.Error == nil {
responseDataObj.Error = errormdl.CheckErr3(err).Error() responseDataObj.Error = err.Error()
} }
errorCode := ab.GetErrorCode() errorCode := ab.GetErrorCode()
if errorCode == 0 { if errorCode == 0 {
......
...@@ -53,7 +53,7 @@ func GetRestrictedServicePtr(serviceName string) (ServiceType, error) { ...@@ -53,7 +53,7 @@ func GetRestrictedServicePtr(serviceName string) (ServiceType, error) {
} }
serviceCache, ok := intService.(ServiceCache) serviceCache, ok := intService.(ServiceCache)
if !ok { if !ok {
return nil, errormdl.Wrap("Service Not Ca") return nil, errormdl.Wrap("Service Not Casted")
} }
return serviceCache.Service, nil return serviceCache.Service, nil
} }
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment