else messages.debug ("debug_query: " + msg + " query= " + query);
}
+// http://stackoverflow.com/questions/7837456/comparing-two-arrays-in-javascript
+// attach the .equals method to Array's prototype to call it on any array
+Array.prototype.equals = function (array) {
+ // if the other array is a falsy value, return
+ if (!array)
+ return false;
+
+ // compare lengths - can save a lot of time
+ if (this.length != array.length)
+ return false;
+
+ for (var i = 0, l=this.length; i < l; i++) {
+ // Check if we have nested arrays
+ if (this[i] instanceof Array && array[i] instanceof Array) {
+ // recurse into the nested arrays
+ if (!this[i].equals(array[i]))
+ return false;
+ }
+ else if (this[i] != array[i]) {
+ // Warning - two different object instances will never be equal: {x:20} != {x:20}
+ return false;
+ }
+ }
+ return true;
+}
+
// http://javascriptweblog.wordpress.com/2011/08/08/fixing-the-javascript-typeof-operator/
Object.toType = (function toType(global) {
return function(obj) {
{
var query_ext = this.find_analyzed_query_ext(query_uuid);
query_ext.filters = $.grep(query_ext.filters, function(x) {
- return x == filter;
+ return !(x.equals(filter));
});
this.apply_filters(query_uuid);
*/
case TYPE_LIST_OF_VALUES: // XXX Until fixed
case TYPE_LIST_OF_RECORDS:
- var new_state,cur_query_uuid;
+ var key, new_state, cur_query_uuid;
cur_query_uuid = query.analyzed_query.subqueries[field].query_uuid;
// - update_query_orig.params.resource = resources in slice before update
// - update_query.params.resource = resource requested in slice
// - keys from field = resources obtained
- var key = manifold.metadata.get_key(field);
+
+ if (field == 'lease') {
+ // lease_id has been added to be repeated when
+ // constructing request rspec. We don't want it for
+ // comparisons
+ key = ['start_time', 'end_time', 'resource'];
+ } else {
+ key = manifold.metadata.get_key(field);
+ }
if (!key)
continue;
/*
// FILTERS
case FILTER_ADDED:
+ console.log("FILTER ADDED", data);
/* Update internal record state */
manifold.query_store.add_filter(query_uuid, data);
break;
case FILTER_REMOVED:
+ console.log("FILTER REMOVED", data);
/* Update internal record state */
manifold.query_store.remove_filter(query_uuid, data);