LP#1472380 Display all Vandelay authority matches
authorBill Erickson <berickxx@gmail.com>
Tue, 7 Jul 2015 19:49:59 +0000 (15:49 -0400)
committerJason Stephenson <jstephenson@mvlc.org>
Fri, 4 Sep 2015 15:47:01 +0000 (11:47 -0400)
Ensure a row is added for every authority record match in the Vandelay
match grid, even when multiple matches refer to the same authority
record.

Signed-off-by: Bill Erickson <berickxx@gmail.com>
Signed-off-by: Jason Stephenson <jstephenson@mvlc.org>
Open-ILS/web/js/ui/default/vandelay/vandelay.js

index 64bef54..682bade 100644 (file)
@@ -649,8 +649,26 @@ function vlLoadMatchUI(recId) {
                 currentMatchedRecords = recs;
                 vlMatchGrid.setStructure(vlMatchGridLayout);
 
+                var cls = 'bre';
+                if (currentType == 'auth') {
+                    cls = 'are';
+
+                    // When fetching authority records from matches, we 
+                    // only fetch one instance of each record, even though
+                    // it may be used by multiple matches.  Modify the
+                    // array of records so that each match has a 
+                    // corresponding authority record in the list.
+                    var new_recs = [];
+                    dojo.forEach(matches, function(match) {
+                        var rec = recs.filter(function(r) { 
+                            return r.id() == match.eg_record() })[0];
+                        new_recs.push(rec);
+                    });
+                    recs = new_recs;
+                }
+
                 // build the data store of records with match information
-                var dataStore = bre.toStoreData(recs, null, 
+                var dataStore = fieldmapper[cls].toStoreData(recs, null,
                     {virtualFields:['_id', 'match_score', 'match_quality', 'rec_quality']});
                 dataStore.identifier = '_id';