summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--web/transaction.js25
1 files changed, 18 insertions, 7 deletions
diff --git a/web/transaction.js b/web/transaction.js
index bbfcf8c..7f56a88 100644
--- a/web/transaction.js
+++ b/web/transaction.js
@@ -73,6 +73,22 @@ define(
return _.isArray(data.data) ? name - 1 : name;
}
+ function findSubordinateKeys(objmap, path) {
+ return _.filter(_.keys(objmap), function(p) {
+ return pth.isSubordinate(p, path);
+ });
+ }
+
+ var set = data.meta.type == "set";
+
+ if (type.isCollection(data.meta) && !set) {
+ var level = pth.split(path).length;
+ _.each(findSubordinateKeys(invalid, path), function(p) {
+ var key = index(pth.split(p)[level]);
+ if (!(key in data.data) data.data[key] = null;
+ });
+ }
+
data.get = function(name, valid) {
var p = pth.join(path, name);
if (!valid && p in invalid) return invalid[p][0];
@@ -96,12 +112,8 @@ define(
data.status = function(name) {
var p = name ? pth.join(path, name) : path;
- function scan(objs) {
- return _.size(_.filter(
- _.keys(objs), function(obj) {
- return pth.isSubordinate(obj, p);
- }
- ));
+ function scan(objmap) {
+ return _.size(findSubordinateKeys(objmap, p));
}
if (scan(invalid)) return "invalid";
@@ -153,7 +165,6 @@ define(
function validate() {
var del = newValue == null;
- var set = data.meta.type == "set";
var options;
if (!del)