mirror of
https://github.com/bckelley/cgm-remote-monitor.git
synced 2026-08-24 03:14:12 -05:00
fix devicestatus retro merge (#5193)
This commit is contained in:
committed by
Sulka Haro
parent
9c42fed941
commit
c4ee62b495
+11
-1
@@ -468,6 +468,16 @@ client.load = function load (serverSettings, callback) {
|
||||
adjustCurrentSGVClasses(value, isCurrent);
|
||||
}
|
||||
|
||||
function mergeDeviceStatus (retro, ddata) {
|
||||
var result = retro.map(x => Object.assign(x, ddata.find(y => y._id == x._id)));
|
||||
|
||||
var missingInRetro = ddata.filter(y => !retro.find(x => x._id == y._id));
|
||||
|
||||
result.push(...missingInRetro);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
function updatePlugins (time) {
|
||||
|
||||
//TODO: doing a clone was slow, but ok to let plugins muck with data?
|
||||
@@ -482,7 +492,7 @@ client.load = function load (serverSettings, callback) {
|
||||
var mergedStatuses = client.ddata.devicestatus;
|
||||
|
||||
if (client.retro.data) {
|
||||
mergedStatuses = _.merge({}, client.retro.data.devicestatus, client.ddata.devicestatus);
|
||||
mergedStatuses = mergeDeviceStatus(client.retro.data.devicestatus, client.ddata.devicestatus);
|
||||
}
|
||||
|
||||
var clonedData = _.clone(client.ddata);
|
||||
|
||||
Reference in New Issue
Block a user