From 788bd98c8c5073066c3e5ee47ec26b9eb521c783 Mon Sep 17 00:00:00 2001 From: Zaid Abdulla Date: Wed, 13 Jul 2016 02:33:39 +0300 Subject: [PATCH] Some fixes on the last commit --- lib/db.coffee | 6 +++--- lib/sandbox.coffee | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/db.coffee b/lib/db.coffee index 1d72cec..22b2b07 100644 --- a/lib/db.coffee +++ b/lib/db.coffee @@ -256,7 +256,7 @@ fetchDevice = (id, timestamp, patterns, callback) -> loaded.push([pattern, 1]) if pattern.length == 0 projection['_timestamp'] = 1 - else if not pattern[0]? + else if pattern[0] == '*' projection[''] = 1 else if pattern[0] == 'Events' if pattern.length == 1 @@ -264,7 +264,7 @@ fetchDevice = (id, timestamp, patterns, callback) -> {exist: timestamp, object: timestamp, writable: timestamp}, {exist: 1, object: 1, writable: 0}]) else if pattern.length == 2 - if not pattern[1]? + if pattern[1] == '*' projection['_registered'] = 1 projection['_lastInform'] = 1 projection['_lastBootstrap'] = 1 @@ -285,7 +285,7 @@ fetchDevice = (id, timestamp, patterns, callback) -> {exist: 1, object: 1, writable: 0}]) else if pattern.length == 2 - if not pattern[1]? + if pattern[1] == '*' projection['_id'] = 1 projection['_deviceId._Manufacturer'] = 1 projection['_deviceId._ProductClass'] = 1 diff --git a/lib/sandbox.coffee b/lib/sandbox.coffee index ec61e12..14b0fbd 100644 --- a/lib/sandbox.coffee +++ b/lib/sandbox.coffee @@ -44,7 +44,7 @@ sandbox.context.Date = class return new Date(sandbox.timestamp) - now: () -> + @now: () -> return sandbox.timestamp @@ -72,7 +72,7 @@ sandbox.context.declare = (decs) -> for attrName, dec of v if Array.isArray(dec) decT[attrName] = dec[0] - decV[attrName] = dec[1] if 1 in dec + decV[attrName] = dec[1] if 1 of dec else decT[attrName] = dec