diff --git a/entity/queryStructValidator.go b/entity/queryStructValidator.go index f0e71e0723c239d109ac95c211aa1ba5454345d3..e866fb9b1feea70015e0b9c9aa53daefd4944567 100644 --- a/entity/queryStructValidator.go +++ b/entity/queryStructValidator.go @@ -69,7 +69,7 @@ Checks if a relation.ToType and relation.ToID are valid Return: bool, whether the ToType and ToID are valid */ func relationToValid(rel QueryRelationStruct, typeString string, minID int, maxID int) bool { - if rel.ToType == typeString && rel.ToID >= minID || rel.ToType == typeString && rel.ToID <= maxID { + if rel.ToType == typeString && rel.ToID >= minID && rel.ToID <= maxID { return true } return false @@ -80,21 +80,21 @@ Checks if a relation.FromType and relation.FromID are valid Return: bool, whether the FromType and FromID are valid */ func relationFromValid(rel QueryRelationStruct, typeString string, minID int, maxID int) bool { - if rel.FromType == typeString && rel.FromID >= minID || rel.FromType == typeString && rel.FromID <= maxID { + if rel.FromType == typeString && rel.FromID >= minID && rel.FromID <= maxID { return true } return false } func groupByGroupValid(groupBy QueryGroupByStruct, typeString string, minID int, maxID int) bool { - if groupBy.GroupType == typeString && groupBy.GroupID >= minID || groupBy.GroupType == typeString && groupBy.GroupID <= maxID { + if groupBy.GroupType == typeString && groupBy.GroupID >= minID && groupBy.GroupID <= maxID { return true } return false } func groupByByValid(groupBy QueryGroupByStruct, typeString string, minID int, maxID int) bool { - if groupBy.ByType == typeString && groupBy.ByID >= minID || groupBy.ByType == typeString && groupBy.ByID <= maxID { + if groupBy.ByType == typeString && groupBy.ByID >= minID && groupBy.ByID <= maxID { return true } return false diff --git a/realtest.json b/realtest.json index b89a9b50b4d0e135fffc6e6fe311140566e1816d..dbfd1cbc78a079835f78b6aedb58899a94bc23b3 100644 --- a/realtest.json +++ b/realtest.json @@ -1,43 +1,42 @@ { + "databaseName": "TweedeKamer", "return": { "entities": [ - 7, - 8 + 0, + 1 ], "relations": [ - 6 - ], - "groupBys": [] + 0 + ] }, "entities": [ { "name": "parliament", - "ID": 7, + "ID": 0, "constraints": [] }, { "name": "parties", - "ID": 8, + "ID": 1, "constraints": [] } ], "relations": [ { - "ID": 6, + "ID": 0, "name": "member_of", "depth": { "min": 1, "max": 1 }, "fromType": "entity", - "fromID": 7, + "fromID": 0, "toType": "entity", - "toID": 8, - "constraints": [] + "toID": -4, + "constraints":[] } ], - "groupBys": [], - "machineLearning": [], + "groupBys": [], "limit": 5000, - "databaseName": "Tweede Kamer" + "modifiers": [] } \ No newline at end of file