fixed canUpdate bug
This commit is contained in:
parent
a6077c1d92
commit
13680815f1
4
app.js
4
app.js
@ -63,7 +63,7 @@ api.on('connection', function(spark) {
|
||||
var info = Nodes.add(data);
|
||||
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());
|
||||
askedForHistory = true;
|
||||
@ -87,7 +87,7 @@ api.on('connection', function(spark) {
|
||||
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());
|
||||
askedForHistory = true;
|
||||
|
@ -136,4 +136,12 @@ Collection.prototype.getHistory = function()
|
||||
return this._history;
|
||||
}
|
||||
|
||||
Collection.prototype.canNodeUpdate = function(id)
|
||||
{
|
||||
var node = this.getNode({id: id});
|
||||
if(!node)
|
||||
return false;
|
||||
return node.canUpdate();
|
||||
}
|
||||
|
||||
module.exports = Collection;
|
Loading…
Reference in New Issue
Block a user