Skip to content

Commit

Permalink
Possible fix to load all streams.
Browse files Browse the repository at this point in the history
  • Loading branch information
mitar committed Aug 19, 2015
1 parent 47d8158 commit 57e6298
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions django_datastream/static/datastream/js/datastream.js
Original file line number Diff line number Diff line change
Expand Up @@ -1048,14 +1048,19 @@
// Streams can be declared to be with some other streams and should be displayed together.
// This method finds charts where at all of existing streams is declared to be with the given stream.
// If a stream is already part of the chart, that chart is not returned.
StreamManager.prototype.groupCharts = function (stream) {
StreamManager.prototype.groupCharts = function (stream, firstPass) {
var self = this;

return _.filter(self.charts, function (chart) {
return _.every(chart.streams, function (chartStream, chartStreamId) {
assert.strictEqual(chartStream.id, chartStreamId);

return chartStream.isWith(stream) || stream.isWith(chartStream);
if (firstPass) {
return stream.isWith(chartStream);
}
else {
return chartStream.isWith(stream) || stream.isWith(chartStream);
}
})
});
};
Expand All @@ -1064,7 +1069,7 @@
StreamManager.prototype.createChart = function (stream) {
var self = this;

var charts = self.groupCharts(stream);
var charts = self.groupCharts(stream, true);

if (charts.length) {
// Stream should be in a group with an existing chart.
Expand All @@ -1081,7 +1086,7 @@
var self = this;

// groupCharts does not return charts where stream is already part of the chart.
var charts = self.groupCharts(stream);
var charts = self.groupCharts(stream, false);

for (var i = 0; i < charts.length; i++) {
charts[i].addStream(stream);
Expand Down

0 comments on commit 57e6298

Please sign in to comment.