Skip to content

Commit be0bacb

Browse files
committed
11
1 parent 9442f97 commit be0bacb

2 files changed

Lines changed: 20 additions & 17 deletions

File tree

OpenFlow/src/DatabaseConnection.ts

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -894,23 +894,26 @@ export class DatabaseConnection {
894894
if (original != null && _version > 0) {
895895
delta = jsondiffpatch.diff(original, item);
896896
if (delta == undefined || delta == null) return 0;
897-
var deltahist = {
898-
_acl: _acl,
899-
_type: _type,
900-
_modified: _modified,
901-
_modifiedby: _modifiedby,
902-
_modifiedbyid: _modifiedbyid,
903-
_created: _modified,
904-
_createdby: _modifiedby,
905-
_createdbyid: _modifiedbyid,
906-
name: item.name,
907-
id: item._id,
908-
item: original,
909-
delta: delta,
910-
_version: _version,
911-
reason: reason
897+
var keys = Object.keys(delta);
898+
if (keys.length > 1) {
899+
var deltahist = {
900+
_acl: _acl,
901+
_type: _type,
902+
_modified: _modified,
903+
_modifiedby: _modifiedby,
904+
_modifiedbyid: _modifiedbyid,
905+
_created: _modified,
906+
_createdby: _modifiedby,
907+
_createdbyid: _modifiedbyid,
908+
name: item.name,
909+
id: item._id,
910+
item: original,
911+
delta: delta,
912+
_version: _version,
913+
reason: reason
914+
}
915+
await this.db.collection(collectionname + '_hist').insertOne(deltahist);
912916
}
913-
await this.db.collection(collectionname + '_hist').insertOne(deltahist);
914917
}
915918
else {
916919
var fullhist = {

VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.0.292
1+
0.0.293

0 commit comments

Comments
 (0)