aboutsummaryrefslogtreecommitdiffstats
path: root/ui/imports/api
diff options
context:
space:
mode:
authorKoren Lev <korenlev@gmail.com>2017-08-14 18:04:50 +0300
committerKoren Lev <korenlev@gmail.com>2017-08-14 18:04:50 +0300
commit502402dde98e63677e34078c50e3854964c81694 (patch)
treeee681d8001b6a5beee5f2a2ad2f52ffeac7bf946 /ui/imports/api
parent472b870cd5fb1eda282af648ef1b0b92d12d8c5e (diff)
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 <korenlev@gmail.com>
Diffstat (limited to 'ui/imports/api')
-rw-r--r--ui/imports/api/inventories/server/methods.js16
1 files changed, 12 insertions, 4 deletions
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);
}