fix filter bug

This commit is contained in:
Devin Howard 2015-11-30 10:01:33 +08:00 committed by Connor Turland
parent 31fceab45d
commit 519342a468

View file

@ -3300,26 +3300,34 @@ Metamaps.Filter = {
// the first option enables us to accept // the first option enables us to accept
// ['Topics', 'Synapses'] as 'collection' // ['Topics', 'Synapses'] as 'collection'
if (typeof collection === "object") { if (typeof collection === "object") {
Metamaps[collection[0]].each(function(model) { Metamaps[collection[0]].each(function(model) {
var prop = model.get(propertyToCheck) ? model.get(propertyToCheck).toString() : false; var prop = model.get(propertyToCheck);
if (prop && newList.indexOf(prop) === -1) { if (prop !== null) {
newList.push(prop); prop = prop.toString();
} if (newList.indexOf(prop) === -1) {
}); newList.push(prop);
Metamaps[collection[1]].each(function(model) { }
var prop = model.get(propertyToCheck) ? model.get(propertyToCheck).toString() : false; }
if (prop && newList.indexOf(prop) === -1) { });
newList.push(prop); Metamaps[collection[1]].each(function(model) {
} var prop = model.get(propertyToCheck);
}); if (prop !== null) {
} prop = prop.toString();
else if (typeof collection === "string") { if (newList.indexOf(prop) === -1) {
Metamaps[collection].each(function(model) { newList.push(prop);
var prop = model.get(propertyToCheck) ? model.get(propertyToCheck).toString() : false; }
if (prop && newList.indexOf(prop) === -1) { }
newList.push(prop); });
} } else if (typeof collection === "string") {
}); Metamaps[collection].each(function(model) {
var prop = model.get(propertyToCheck);
if (prop !== null) {
prop = prop.toString();
if (newList.indexOf(prop) === -1) {
newList.push(prop);
}
}
});
} }
removed = _.difference(self.filters[filtersToUse], newList); removed = _.difference(self.filters[filtersToUse], newList);