Skip to content
Snippets Groups Projects
Commit 9a17cad5 authored by Leonardo Christino's avatar Leonardo Christino
Browse files

fix: correctly filter relationship list

parent 7ab3a098
No related branches found
No related tags found
No related merge requests found
Pipeline #127999 failed
......@@ -346,11 +346,9 @@ func formQuery(JSONQuery *entityv2.IncomingQueryJSON) (*string, error) {
for _, relation := range cacheData.relations {
// if we need to do logic on relations, this with is required
withLine := fmt.Sprintf("WITH *, relationships(%s) AS %s_rel\n", relation.queryId, relation.queryId)
if relation.queryId != "" && strings.Contains(logic, relation.id) && !strings.Contains(totalQuery, withLine) {
totalQuery += withLine
logic = fmt.Sprintf("ALL(%s_rel_%s in %s_rel WHERE %s)",
relation.queryId, relation.id, relation.queryId,
if relation.queryId != "" && strings.Contains(logic, relation.id) {
logic = fmt.Sprintf("ALL(%s_rel_%s in %s WHERE %s)",
relation.queryId, relation.id, relation.id,
strings.ReplaceAll(logic, relation.id, fmt.Sprintf("%s_rel_%s", relation.queryId, relation.id)))
}
}
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment