Minor fix.

This commit is contained in:
Paulo Gustavo Veiga 2012-11-17 13:57:06 -03:00
parent e70f2726a3
commit f44e616a4b

View File

@ -150,17 +150,20 @@ mindplot.commands.DeleteCommand = new Class({
}, this); }, this);
result.append(rels.flatten()); result.append(rels.flatten());
// Filter for unique ... if (result.length > 0) {
result = result.sort(function (a, b) { // Filter for unique ...
return a.getModel().getId() - b.getModel().getId(); result = result.sort(function (a, b) {
}); return a.getModel().getId() - b.getModel().getId();
var ret = [result[0]]; });
for (var i = 1; i < result.length; i++) { // start loop at 1 as element 0 can never be a duplicate var ret = [result[0]];
if (result[i - 1] !== result[i] && result[i] != null) { for (var i = 1; i < result.length; i++) { // start loop at 1 as element 0 can never be a duplicate
ret.push(result[i]); if (result[i - 1] !== result[i]) {
ret.push(result[i]);
}
} }
result = ret;
} }
return ret; return result;
} }
}); });