From 763e8eb3f91dac14239ad3820672be12adca57b0 Mon Sep 17 00:00:00 2001
From: Kieran van Gaalen <kieran.van.gaalen@casema.nl>
Date: Tue, 23 Nov 2021 14:03:48 +0100
Subject: [PATCH] All tests fixed

---
 entity/queryStructValidator.go |  8 ++++----
 realtest.json                  | 27 +++++++++++++--------------
 2 files changed, 17 insertions(+), 18 deletions(-)

diff --git a/entity/queryStructValidator.go b/entity/queryStructValidator.go
index f0e71e0..e866fb9 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 b89a9b5..dbfd1cb 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
-- 
GitLab