Author: ygrego Date: 2015-02-28 21:35:30 +0000 (Sat, 28 Feb 2015) New Revision: 893 Url: http://forge.nuiton.org/projects/sandbox/repository/revisions/893 Log: It is necessary to do absolute for the index calculation of previous/next element in a list because this calculation can be negative.(Into method "_findChannel") Modified: oipf/js/impl/VideoBroadcastObject.js Modified: oipf/js/impl/VideoBroadcastObject.js =================================================================== --- oipf/js/impl/VideoBroadcastObject.js 2015-02-28 21:02:50 UTC (rev 892) +++ oipf/js/impl/VideoBroadcastObject.js 2015-02-28 21:35:30 UTC (rev 893) @@ -410,6 +410,7 @@ channelCollection = channelConfig.currentFavouriteLists; } var previousChannel = this._findChannel(channelCollection, this.currentChannel, - 1); + console.log(previousChannel, channelCollection, this.currentChannel); var tunerFound = this._verifyASuitableTunerAvailable(previousChannel.idType); if (tunerFound) { //ToDO: Error handling, if the switch fail, this instruction correspond to channel switch. @@ -535,7 +536,7 @@ _findChannel: function(channelCollection, channel, step) { for (var keys = Object.keys(channelCollection) in channelCollection) { if (channelCollection[keys] == channel) { - return channelCollection[(keys%channelCollection.length)+step]; + return channelCollection[Math.abs((keys%(channelCollection.length))+step)]; } } return null;
participants (1)
-
ygregoï¼ users.nuiton.org