Don't remove root Tags when empty

It unnecessarily complicates things.
This commit is contained in:
Zaid Abdulla committed 2017-07-30 04:54:55 -07:00
1 parent 0ca44d7ffb
commit 306193e6e9
2 files changed
+3 -9

No files matched your search

+3 -2
View File
@@ -333,8 +333,9 @@ fetchDevice = (id, timestamp, patterns, callback) ->
{object: [timestamp, 0], writable: [timestamp, 0], value: [timestamp, [v, 'xsd:string']]}])
delete device[k]
when '_tags'
res.push([['Tags'], timestamp,
{object: [timestamp, 1], writable: [timestamp, 0]}])
if v.length
res.push([['Tags'], timestamp,
{object: [timestamp, 1], writable: [timestamp, 0]}])
for t in v
t = t.replace(/[^a-zA-Z0-9\-]+/g, '_')
res.push([['Tags', t], timestamp,
-7
View File
@@ -698,13 +698,6 @@ rpcRequest = (sessionContext, _declarations, callback) ->
toClear = device.set(sessionContext.deviceData, p, timestamp, {object: [timestamp, false], writable: [timestamp, true], value: [timestamp, [true, 'xsd:boolean']]}, toClear)
else if c? and not v
toClear = device.set(sessionContext.deviceData, p, timestamp, toClear)
noMoreTags = true
for p in sessionContext.deviceData.paths.find(['Tags', '*'], false, true)
if sessionContext.deviceData.attributes.has(p)
noMoreTags = false
break
if noMoreTags
toClear = device.set(sessionContext.deviceData, ['Tags'], timestamp, null, toClear)
)
# Downloads