From 0a8b5aea097110b74164876b13b342a524fcfc99 Mon Sep 17 00:00:00 2001 From: Mike Rylander Date: Tue, 15 May 2018 17:21:00 -0400 Subject: [PATCH] LP#1770478: Offline org unit tree can break A thinko in the org tree reconstruction for offline mode caused the tree to be broken in some situations, when the orgs were not ordered strictly by ID in the list stored in the browser's IndexedDB storage. This commit removes that requirement, and allows trees of any ID and storage ordering to be reconstituted. Signed-off-by: Mike Rylander Signed-off-by: Jeff Davis Signed-off-by: Jason Stephenson --- Open-ILS/web/js/ui/default/staff/services/lovefield.js | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/Open-ILS/web/js/ui/default/staff/services/lovefield.js b/Open-ILS/web/js/ui/default/staff/services/lovefield.js index 174a420269..d0cd9c12ee 100644 --- a/Open-ILS/web/js/ui/default/staff/services/lovefield.js +++ b/Open-ILS/web/js/ui/default/staff/services/lovefield.js @@ -402,15 +402,17 @@ angular.module('egCoreMod') angular.forEach(list, function (item) { item.children([]); // just clear it out if there's junk in there - if (item[parent_field]()) { - item[parent_field]( hash[''+item[parent_field]()] ); - } - item.children( list.filter(function (kid) { return kid[parent_field]() == item[pkey](); }) ); }); + angular.forEach(list, function (item) { + if (item[parent_field]()) { + item[parent_field]( hash[''+item[parent_field]()] ); + } + }); + egCore.env.absorbTree(top, type, true) return $q.when(true) }); -- 2.11.0