aboutsummaryrefslogtreecommitdiffstats
path: root/ui/imports/api/inventories/server/methods.js
diff options
context:
space:
mode:
Diffstat (limited to 'ui/imports/api/inventories/server/methods.js')
-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);
}