From c70762bd034fd6c212f8c9b40edbef016e422895 Mon Sep 17 00:00:00 2001
From: Joris <j.r.j.lelieveld@students.uu.nl>
Date: Tue, 1 Jun 2021 15:29:13 +0200
Subject: [PATCH] Bugfix off by one in modifier connect

---
 aql/convertQuery.go | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/aql/convertQuery.go b/aql/convertQuery.go
index 852571c..e1e1fe4 100644
--- a/aql/convertQuery.go
+++ b/aql/convertQuery.go
@@ -159,9 +159,11 @@ func createQuery(JSONQuery *entity.IncomingQueryJSON) *string {
 			if modifier.SelectedType == "entity" {
 				// ASSUMING THERE IS ONLY 1 RELATION
 				if JSONQuery.Relations[0].EntityFrom == modifier.ID {
-					pathDistinction = fmt.Sprintf(".vertices[%v]", JSONQuery.Relations[0].Depth.Min-1)
+					// This should always be 0, because that is the start of the path
+					pathDistinction = ".vertices[0]"
 
 				} else {
+					// Otherwise take the depth.max -1 to get the last
 					pathDistinction = fmt.Sprintf(".vertices[%v]", JSONQuery.Relations[0].Depth.Max)
 
 				}
-- 
GitLab