LP1806087 Grouped results jump to detail on single rec
authorBill Erickson <berickxx@gmail.com>
Wed, 26 Dec 2018 16:45:50 +0000 (11:45 -0500)
committerBill Erickson <berickxx@gmail.com>
Thu, 10 Jan 2019 17:24:17 +0000 (12:24 -0500)
Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/eg2/src/app/share/catalog/bib-record.service.ts
Open-ILS/src/eg2/src/app/staff/catalog/result/record.component.ts

index 6b00e79..686423f 100644 (file)
@@ -24,6 +24,7 @@ export const HOLDINGS_XPATH =
 export class BibRecordSummary {
     id: number; // == record.id() for convenience
     metabibId: number; // If present, this is a metabib summary
+    metabibRecords: number[]; // all constituent bib records
     orgId: number;
     orgDepth: number;
     record: IdlObject;
@@ -42,6 +43,7 @@ export class BibRecordSummary {
         this.display = {};
         this.attributes = {};
         this.bibCallNumber = null;
+        this.metabibRecords = [];
     }
 
     ingest() {
@@ -223,6 +225,8 @@ export class BibRecordService {
         this.getBibSummary(metabib.master_record(), orgId, orgDepth)
         .subscribe(summary => {
             summary.metabibId = metabib.id();
+            summary.metabibRecords = 
+                metabib.source_maps().map(map => Number(map.source()))
 
             let promise;
 
index 5e6d25b..737de6f 100644 (file)
@@ -79,14 +79,16 @@ export class ResultRecordComponent implements OnInit, OnDestroy {
     navigatToRecord(summary: BibRecordSummary) {
         const params = this.catUrl.toUrlParams(this.searchContext);
 
-        if (summary.metabibId) {
+        // Jump to metarecord constituent records page when a 
+        // MR has more than 1 constituents.
+        if (summary.metabibId && summary.metabibRecords.length > 1) {
             this.searchContext.termSearch.fromMetarecord = summary.metabibId;
             this.staffCat.search();
             return;
         }
 
         this.router.navigate(
-          ['/staff/catalog/record/' + summary.id], {queryParams: params});
+            ['/staff/catalog/record/' + summary.id], {queryParams: params});
     }
 
     toggleBasketEntry() {