LPXXX Vandelay Matches grid correctly handles dupe targets user/berick/lpxxx-vand-multi-matches
authorBill Erickson <berickxx@gmail.com>
Mon, 5 Apr 2021 15:47:26 +0000 (11:47 -0400)
committerBill Erickson <berickxx@gmail.com>
Mon, 5 Apr 2021 15:47:28 +0000 (11:47 -0400)
Fixes an issue where a queued record matches a bib record via multiple
matches and the user is unable to select only one of the matches for
overlay.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Open-ILS/src/eg2/src/app/staff/cat/vandelay/import.component.ts
Open-ILS/src/eg2/src/app/staff/cat/vandelay/queued-record-matches.component.ts
Open-ILS/src/eg2/src/app/staff/cat/vandelay/vandelay.service.ts

index 08f795d..d076bf1 100644 (file)
@@ -574,7 +574,11 @@ export class ImportComponent implements OnInit, AfterViewInit, OnDestroy {
         };
 
         if (this.vandelay.importSelection) {
-            options.overlay_map = this.vandelay.importSelection.overlayMap;
+            options.overlay_map = {};
+            for (let recId in this.vandelay.importSelection.overlayMap) {
+                options.overlay_map[recId] =
+                    this.vandelay.importSelection.overlayMap[recId].eg_record();
+            }
         }
 
         return options;
index 10060e0..447e7c0 100644 (file)
@@ -20,7 +20,7 @@ import {VandelayService, VandelayImportSelection} from './vandelay.service';
 export class QueuedRecordMatchesComponent implements OnInit {
 
     @Input() queueType: string;
-    @Input() recordId: number;
+    @Input() recordId: number; // queued record ID
     @ViewChild('bibGrid', { static: false }) bibGrid: GridComponent;
     @ViewChild('authGrid', { static: false }) authGrid: GridComponent;
 
@@ -85,15 +85,18 @@ export class QueuedRecordMatchesComponent implements OnInit {
                 this.vandelay.importSelection = selection;
             }
             const match = this.matchMap[matchId];
-            selection.overlayMap[this.recordId] = match.eg_record();
+            selection.overlayMap[this.recordId] = match;
         }
     }
 
     isOverlayTarget(matchId: number): boolean {
         const selection = this.vandelay.importSelection;
         if (selection) {
-            const match = this.matchMap[matchId];
-            return selection.overlayMap[this.recordId] === match.eg_record();
+            const forRec: IdlObject = selection.overlayMap[this.recordId];
+            if (forRec) {
+                const match = this.matchMap[matchId];
+                return forRec.id() === match.id();
+            }
         }
         return false;
     }
index cd52d44..3d97ba1 100644 (file)
@@ -19,7 +19,7 @@ export class VandelayImportSelection {
     recordIds: number[];
     queue: IdlObject;
     importQueue: boolean; // import the whole queue
-    overlayMap: {[qrId: number]: /* breId */ number};
+    overlayMap: {[qrId: number]: /* match */ IdlObject};
 
     constructor() {
        this.recordIds = [];