https://bugs.koha-community.org/bugzilla3/show_bug.cgi?id=17710

            Bug ID: 17710
           Summary: C4::Matcher::get_matches and
                    C4::ImportBatch::GetBestRecordMatch should use same
                    logic
 Change sponsored?: ---
           Product: Koha
           Version: master
          Hardware: All
                OS: All
            Status: NEW
          Severity: enhancement
          Priority: P5 - low
         Component: MARC Bibliographic record staging/import
          Assignee: gmcha...@gmail.com
          Reporter: dc...@prosentient.com.au
        QA Contact: testo...@bugs.koha-community.org

C4::Matcher::get_matches sorts its rows in descending order using score, while
C4::ImportBatch::GetBestRecordMatch sorts its rows in descending order using
score and record id. 

To get the best record match, C4::ImportBatch::GetBestRecordMatch takes the top
result. 

By contrast, C4::Matcher::get_matches could easily return different rows in the
top position if there are multiple rows with the same score, since its array is
populated using a hash where order doesn't matter. 

It's an easy enough fix,  although I will admit to finding the solution on
StackOverflow:

"Since <=> and cmp return 0 to indicate equality, and that's false, and because
Perl's logical Boolean operators return the deciding value instead of just 0 or
1, sorting by multiple keys is as easy as stringing multiple comparisons
together with or or ||"

http://stackoverflow.com/questions/10395383/sorting-an-array-of-hash-by-multiple-keys-perl

-- 
You are receiving this mail because:
You are watching all bug changes.
_______________________________________________
Koha-bugs mailing list
Koha-bugs@lists.koha-community.org
http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-bugs
website : http://www.koha-community.org/
git : http://git.koha-community.org/
bugs : http://bugs.koha-community.org/

Reply via email to