From 02215fb96901a82e6117051517fd475f07c7d3cf Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Thu, 6 Dec 2018 11:25:18 -0500 Subject: [PATCH] LP#1806087 Catalog org settings speed improvement Signed-off-by: Bill Erickson --- .../src/eg2/src/app/core/server-store.service.ts | 2 +- .../eg2/src/app/staff/catalog/resolver.service.ts | 24 ++++++++-------------- 2 files changed, 10 insertions(+), 16 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/core/server-store.service.ts b/Open-ILS/src/eg2/src/app/core/server-store.service.ts index 43415c1951..ea2d93da36 100644 --- a/Open-ILS/src/eg2/src/app/core/server-store.service.ts +++ b/Open-ILS/src/eg2/src/app/core/server-store.service.ts @@ -65,7 +65,7 @@ export class ServerStoreService { const values: any = {}; keys.forEach(key => { - if (this.cache[key]) { + if (key in this.cache) { values[key] = this.cache[key]; } }); diff --git a/Open-ILS/src/eg2/src/app/staff/catalog/resolver.service.ts b/Open-ILS/src/eg2/src/app/staff/catalog/resolver.service.ts index 729beea0b0..ba31c98db7 100644 --- a/Open-ILS/src/eg2/src/app/staff/catalog/resolver.service.ts +++ b/Open-ILS/src/eg2/src/app/staff/catalog/resolver.service.ts @@ -38,22 +38,16 @@ export class CatalogResolver implements Resolve> { } fetchSettings(): Promise { - const promises = []; - promises.push( - this.store.getItem('eg.search.search_lib').then( - id => this.staffCat.defaultSearchOrg = this.org.get(id) - ) - ); - - promises.push( - this.store.getItem('eg.search.pref_lib').then( - id => this.staffCat.prefOrg = this.org.get(id) - ) - ); - - return Promise.all(promises); + return this.store.getItemBatch([ + 'eg.search.search_lib', + 'eg.search.pref_lib' + ]).then(settings => { + this.staffCat.defaultSearchOrg = + this.org.get(settings['eg.search.search_lib']); + this.staffCat.prefOrg = + this.org.get(settings['eg.search.pref_lib']); + }) } - } -- 2.11.0