From 502402dde98e63677e34078c50e3854964c81694 Mon Sep 17 00:00:00 2001 From: Koren Lev Date: Mon, 14 Aug 2017 18:04:50 +0300 Subject: add mulitple dept attirubute showing in popup window + lose us-move-up-scan-opening-message-in-ui Change-Id: I3480d155c418c30224856f89c874c889dd3da9e5 Signed-off-by: Koren Lev --- ui/imports/api/inventories/server/methods.js | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) (limited to 'ui/imports/api/inventories') diff --git a/ui/imports/api/inventories/server/methods.js b/ui/imports/api/inventories/server/methods.js index ec2f27d..3daf570 100644 --- a/ui/imports/api/inventories/server/methods.js +++ b/ui/imports/api/inventories/server/methods.js @@ -143,9 +143,17 @@ function calcAttrsForNode(node, attrsDefsRec) { let attrsDefs = attrsDefsRec.attributes; return R.reduce((acc, attrDef) => { - return R.ifElse(R.isNil, - R.always(acc), - (attrVal) => R.append(R.assoc(attrDef, attrVal, {}), acc) - )(R.prop(attrDef, node)); + if (R.is(Array, attrDef)) { + let value = R.path(attrDef, node); + if (R.isNil(value)) { return acc; } + let name = R.join('.', attrDef); + return R.append(R.assoc(name, value, {}), acc); + + } else { + return R.ifElse(R.isNil, + R.always(acc), + (attrVal) => R.append(R.assoc(attrDef, attrVal, {}), acc) + )(R.prop(attrDef, node)); + } }, [], attrsDefs); } -- cgit 1.2.3-korg