From 13884ba21a42abb01682b24182d17929c67ef133 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Henrik=20tom=20W=C3=B6rden?= <h.tomwoerden@indiscale.com>
Date: Thu, 21 Jan 2021 16:47:32 +0000
Subject: [PATCH] FIX: Show parents in map when path is used

---
 src/core/js/ext_map.js             | 4 ++--
 test/core/js/modules/ext_map.js.js | 6 +++---
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/core/js/ext_map.js b/src/core/js/ext_map.js
index d71a1d1a..3b89f72b 100644
--- a/src/core/js/ext_map.js
+++ b/src/core/js/ext_map.js
@@ -438,7 +438,7 @@ var caosdb_map = new function () {
         } else {
             pov = caosdb_map._get_id_POV(ids);
         }
-        return `SELECT ${selector}${datamodel.lat},${selector}${datamodel.lng} FROM ENTITY ${recordtype} ${pov} `;
+        return `SELECT parent,${selector}${datamodel.lat},${selector}${datamodel.lng} FROM ENTITY ${recordtype} ${pov} `;
 
     }
 
@@ -2229,4 +2229,4 @@ entity.`;
 
 $(document).ready(function () {
     caosdb_modules.register(caosdb_map);
-});
\ No newline at end of file
+});
diff --git a/test/core/js/modules/ext_map.js.js b/test/core/js/modules/ext_map.js.js
index d14d7ebf..5afe434e 100644
--- a/test/core/js/modules/ext_map.js.js
+++ b/test/core/js/modules/ext_map.js.js
@@ -260,13 +260,13 @@ QUnit.test("_get_select_with_path  ", function (assert) {
     assert.throws(() => caosdb_map._get_select_with_path(this.datamodel, []), /Supply at least a RecordType./, "missing value");
     assert.equal(caosdb_map._get_select_with_path(
         this.datamodel,
-        ["RealRT"]), "SELECT latitude,longitude FROM ENTITY RealRT  WITH latitude AND longitude ", "RT only");
+        ["RealRT"]), "SELECT parent,latitude,longitude FROM ENTITY RealRT  WITH latitude AND longitude ", "RT only");
     assert.equal(caosdb_map._get_select_with_path(
         this.datamodel,
-        ["RealRT", "prop1"]), "SELECT prop1.latitude,prop1.longitude FROM ENTITY RealRT  WITH prop1  WITH latitude AND longitude ", "RT with one prop");
+        ["RealRT", "prop1"]), "SELECT parent,prop1.latitude,prop1.longitude FROM ENTITY RealRT  WITH prop1  WITH latitude AND longitude ", "RT with one prop");
     assert.equal(caosdb_map._get_select_with_path(
         this.datamodel,
-        ["RealRT", "prop1", "prop2"]), "SELECT prop1.prop2.latitude,prop1.prop2.longitude FROM ENTITY RealRT  WITH prop1  WITH prop2  WITH latitude AND longitude ", "RT with two props");
+        ["RealRT", "prop1", "prop2"]), "SELECT parent,prop1.prop2.latitude,prop1.prop2.longitude FROM ENTITY RealRT  WITH prop1  WITH prop2  WITH latitude AND longitude ", "RT with two props");
 });
 
 
-- 
GitLab