From 0cf720e5fcb6589c56713aa18959f98eaf9fc569 Mon Sep 17 00:00:00 2001 From: Bill Erickson Date: Fri, 21 Aug 2020 17:02:10 -0400 Subject: [PATCH] LP1904036 patron UI noncat/holds summary Signed-off-by: Bill Erickson Signed-off-by: Jane Sandberg Signed-off-by: Galen Charlton --- .../src/app/staff/circ/patron/patron.service.ts | 34 ++++++++++++++++++++-- .../app/staff/circ/patron/summary.component.html | 6 ++-- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.service.ts b/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.service.ts index 0f1a8bbe56..684ec84381 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.service.ts +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/patron.service.ts @@ -31,8 +31,13 @@ interface PatronStats { lost: number, out: number, total_out: number, - long_overdue: number + long_overdue: number, + noncat: number }; + holds: { + ready: number; + total: number; + } } @Injectable() @@ -76,6 +81,12 @@ export class PatronManagerService { this.accountExpired = false; this.accountExpiresSoon = false; + // When quickly navigating patron search results it's possible + // for this.patron to be cleared right before this function + // is called. Exit early instead of making an unneeded call. + // For this func. in particular a nasty JS error is thrown. + if (!this.patron) { return Promise.resolve(); } + return this.patronService.testExpire(this.patron) .then(value => { if (value === 'expired') { @@ -88,6 +99,11 @@ export class PatronManagerService { getPatronStats(id: number): Promise { + // When quickly navigating patron search results it's possible + // for this.patron to be cleared right before this function + // is called. Exit early instead of making an unneeded call. + if (!this.patron) { return Promise.resolve(); } + return this.net.request( 'open-ils.actor', 'open-ils.actor.user.opac.vital_stats.authoritative', @@ -112,7 +128,21 @@ export class PatronManagerService { stats.checkouts.total_out += stats.checkouts.lost } - return this.patronStats = stats; + this.patronStats = stats; + + }).then(_ => { + + if (!this.patron) { return; } + + return this.net.request( + 'open-ils.circ', + 'open-ils.circ.open_non_cataloged_circulation.user.authoritative', + this.auth.token(), id).toPromise() + + }).then(noncats => { + if (noncats && this.patronStats) { + this.patronStats.checkouts.noncat = noncats.length; + } }); } } diff --git a/Open-ILS/src/eg2/src/app/staff/circ/patron/summary.component.html b/Open-ILS/src/eg2/src/app/staff/circ/patron/summary.component.html index a7e7cf84a7..cdeaf97875 100644 --- a/Open-ILS/src/eg2/src/app/staff/circ/patron/summary.component.html +++ b/Open-ILS/src/eg2/src/app/staff/circ/patron/summary.component.html @@ -88,11 +88,13 @@
Non-Cataloged
-
XXXX
+
{{context.patronStats.checkouts.noncat}}
Holds
-
XX / YY
+
+ {{context.patronStats.holds.ready}} / {{context.patronStats.holds.total}} +

-- 2.11.0