From 8d0097859797d7d19dbb665295c1f7801cfb79bf Mon Sep 17 00:00:00 2001 From: Timm Fitschen <t.fitschen@indiscale.com> Date: Fri, 6 May 2022 09:51:15 +0200 Subject: [PATCH] DOC: update docstrings and CHANGELOG --- CHANGELOG.md | 3 +++ misc/map_test_data.py | 1 - src/core/js/caosdb.js | 16 ++++++++++++++-- 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 9c980ba7..5fd6d4fc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added +* [#172](https://gitlab.com/caosdb/caosdb-webui/-/issues/172) - Map can handle + geo locations in list of references. + ### Changed ### Deprecated diff --git a/misc/map_test_data.py b/misc/map_test_data.py index 657a01f2..eda56c0e 100755 --- a/misc/map_test_data.py +++ b/misc/map_test_data.py @@ -8,7 +8,6 @@ import caosdb import random caosdb.get_connection()._login() -caosdb.execute_query("FIND ENTITY WITH ID > 99").delete() # data model datamodel = caosdb.Container() diff --git a/src/core/js/caosdb.js b/src/core/js/caosdb.js index 0df57dd4..5a30ce55 100644 --- a/src/core/js/caosdb.js +++ b/src/core/js/caosdb.js @@ -734,6 +734,16 @@ var _constructXpaths = function (selectors) { * * `getPropertyValues(entities, [["Geo Location", "latitude"], ["Geo Location", "longitude"]])` * + * When the entitieshave normal non-list references to the "Geo Location" the + * result looks like this: + * + * `[[ "50", "-39"], ...]` + * + * When the entities have a LIST of thre Geo Locations the result looks like + * this: + * + * `[[[ "50", "51", "52"], [ "-39", "-38", "-37" ]], ...]`. + * * Use empty strings for selector elements when the property name is irrelevant: * * `getPropertyValues(entities, [["", "latitude"], ["", "longitude"]])` @@ -748,9 +758,11 @@ var _constructXpaths = function (selectors) { * special cases ("name", "description", "unit", etc.) are to be added when * needed. * - * @param {XMLElement[]) entities + * @param {XMLElement[]} entities * @param {String[][]} selectors - * @return {String[][]} A table of the property values for each entity. + * @return {String[][]} A table of the property values for each entity (index + * order is `[row][column]`). Each row is an entity, each column is a value + * (or an array of values, when the entity has list properties). */ var getPropertyValues = function (entities, selectors) { const entity_iter = entities.evaluate("/Response/Record", entities); -- GitLab