commit
cd99ff8c18
4
app.js
4
app.js
@ -63,7 +63,7 @@ api.on('connection', function(spark) {
|
|||||||
var info = Nodes.add(data);
|
var info = Nodes.add(data);
|
||||||
spark.emit('ready');
|
spark.emit('ready');
|
||||||
|
|
||||||
if(Nodes.getHistory().requiresUpdate() && !askedForHistory && Nodes.getNode({id: data.id}).canUpdate())
|
if(Nodes.getHistory().requiresUpdate() && !askedForHistory && Nodes.canNodeUpdate(data.id))
|
||||||
{
|
{
|
||||||
spark.emit('history', Nodes.getHistory().getHistoryRequestInterval());
|
spark.emit('history', Nodes.getHistory().getHistoryRequestInterval());
|
||||||
askedForHistory = true;
|
askedForHistory = true;
|
||||||
@ -87,7 +87,7 @@ api.on('connection', function(spark) {
|
|||||||
client.write({action: 'charts', data: Nodes.getCharts()});
|
client.write({action: 'charts', data: Nodes.getCharts()});
|
||||||
}
|
}
|
||||||
|
|
||||||
if(Nodes.getHistory().requiresUpdate() && !askedForHistory && Nodes.getNode({id: data.id}).canUpdate())
|
if(Nodes.getHistory().requiresUpdate() && !askedForHistory && Nodes.canNodeUpdate(data.id))
|
||||||
{
|
{
|
||||||
spark.emit('history', Nodes.getHistory().getHistoryRequestInterval());
|
spark.emit('history', Nodes.getHistory().getHistoryRequestInterval());
|
||||||
askedForHistory = true;
|
askedForHistory = true;
|
||||||
|
@ -136,4 +136,12 @@ Collection.prototype.getHistory = function()
|
|||||||
return this._history;
|
return this._history;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Collection.prototype.canNodeUpdate = function(id)
|
||||||
|
{
|
||||||
|
var node = this.getNode({id: id});
|
||||||
|
if(!node)
|
||||||
|
return false;
|
||||||
|
return node.canUpdate();
|
||||||
|
}
|
||||||
|
|
||||||
module.exports = Collection;
|
module.exports = Collection;
|
Loading…
Reference in New Issue
Block a user