Skip to content

Commit

Permalink
test if scope has property before overidding it
Browse files Browse the repository at this point in the history
  • Loading branch information
Pierre-Gilles committed Nov 12, 2016
1 parent a437616 commit 1a2388d
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions api/core/scenario/scenario.trigger.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ module.exports = function(params) {

// initialize scope
params.scope = params.scope || {};
if(params.house) params.scope.house = params.house;
if(params.user) params.scope.user = params.user;
if(params.room) params.scope.room = params.room;
if(params.value) params.scope.value = params.value;
if(params.datetime) params.scope.datetime = params.datetime;
if(params.house && !params.scope.hasOwnProperty('house')) params.scope.house = params.house;
if(params.user && !params.scope.hasOwnProperty('user')) params.scope.user = params.user;
if(params.room && !params.scope.hasOwnProperty('room')) params.scope.room = params.room;
if(params.value && !params.scope.hasOwnProperty('value')) params.scope.value = params.value;
if(params.datetime && !params.scope.hasOwnProperty('datetime')) params.scope.datetime = params.datetime;

// foreach launcher, we verify if the condition is satisfied
// and if yes, start all the actions
Expand Down

0 comments on commit 1a2388d

Please sign in to comment.