Author: ygrego Date: 2015-04-10 12:53:56 +0000 (Fri, 10 Apr 2015) New Revision: 1146 Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/1146 Log: Refactoring of method "getResults" and minimal implementation of method "abort". Modified: oipf/js/impl/model/SearchResults.js Modified: oipf/js/impl/model/SearchResults.js =================================================================== --- oipf/js/impl/model/SearchResults.js 2015-04-10 12:51:17 UTC (rev 1145) +++ oipf/js/impl/model/SearchResults.js 2015-04-10 12:53:56 UTC (rev 1146) @@ -162,7 +162,7 @@ if (time >= programme.startTime && time <= stopTime) { - + console.log(programme); this._timeout() .then(function() { self._cachedResults.push(programme); @@ -170,20 +170,13 @@ // self.totalSize = self.length; console.log("[INFO] Program found."); }) - .then(this._timeout) + .then(this._timeout.bind(self, 10000)) .then(getResultFromInterval.bind(null, count)) - .then(this._timeout) .then(this._fireEvent.bind(this, createCustomEvent("MetadataSearch", [this._search, this.SEARCH_FINISHED]))); break; } - } else { - this._fireEvent( - createCustomEvent("MetadataSearch", - [this._search, - this.SEARCH_CANNOT_BE_COMPLETED])); - break; } } else if (programme[field] && @@ -196,17 +189,30 @@ if(constraints.length > 0 && oipf.utils.isPresent(constraints, programme.channel.name)) { - + console.log("constraint", programme); /* * The results found are firstly put in a cache, * then gathered. */ - this._timeout() - .then(function() { - self._cachedResults.push(programme); - console.log("[INFO] Program found."); - }); +// this._timeout() +// .then(function() { +// self._cachedResults.push(programme); +// console.log("[INFO] Program found."); +// }); + this._cachedResults.push(programme); + continue; } + + if (constraints.length == 0) { + + console.log("without constraint", programme); + this._cachedResults.push(programme); +// this._timeout() +// .then(function() { +// self._cachedResults.push(programme); +// console.log("[INFO] Program found."); +// }); + } } } @@ -219,7 +225,6 @@ if (this._search._currentQuery._type == "undifferent") { this._timeout() .then(getResultFromInterval.bind(null, count)) - .then(this._timeout) .then(this._fireEvent.bind(this, createCustomEvent("MetadataSearch", [this._search, this.SEARCH_FINISHED]))); @@ -250,7 +255,7 @@ * */ abort: function() { - + this._timerManager.clearTimer(); }, /*
participants (1)
-
ygregoï¼ users.nuiton.org