Author: ygrego Date: 2015-03-11 14:03:55 +0000 (Wed, 11 Mar 2015) New Revision: 934 Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/934 Log: Implementation of method "getChannelBySourceID". Modified: oipf/js/impl/model/ChannelList.js Modified: oipf/js/impl/model/ChannelList.js =================================================================== --- oipf/js/impl/model/ChannelList.js 2015-03-11 14:01:58 UTC (rev 933) +++ oipf/js/impl/model/ChannelList.js 2015-03-11 14:03:55 UTC (rev 934) @@ -63,9 +63,7 @@ var self = this; if (nid) { - var test = function(i) { - if (self[i].onid == onid && self[i].tsid == tsid && self[i].sid == sid && self[i].nid == nid) { return self[i]; } @@ -73,7 +71,6 @@ } else { test = function(i) { - if (self[i].onid == onid && self[i].tsid == tsid && self[i].sid == sid) { return self[i]; } @@ -81,9 +78,10 @@ } for (var i = 0, l = this.length; i < l; i++) { - test(i); } + + return null; }, /* @@ -99,7 +97,12 @@ * Return: Channel */ getChannelBySourceID: function(sourceID) { - + + for (var i = 0, l = this.length; i < l; i++) { + if (this[i].sourceID == sourceID) { + return this[i]; + } + } } }); \ No newline at end of file