Small bug in the loop handling logic. The outer loop which updates the current marc text doesn't get to continue the next round if there's a title mismatch in the inner loop. All the titles get compared to the same marc text.

CommentFileSizeAuthor
#1 millennium-729016.patch994 bytestituomin

Comments

tituomin’s picture

StatusFileSize
new994 bytes
janusman’s picture

Status: Needs review » Postponed (maintainer needs more info)

Hmm, I'm thinking this is actually *not* a problem.

Let me explain the logic and then maybe try to figure out why this works for you but shouldn't (IMO) =)

In millennium.import.inc :: millennium_fetch_records_via_bookcart():

Line 238:

// Get cart contents: only item and bib numbers
// From matches in list we can determine if some item numbers do not actually exist in the database.

We need this list to get the actual title-bib record number relationships.
Now, this list output behaves "incorrectly"... showing non-existing records in it by repeating the previous existing record's title (e.g. record b12345 is item 1 in the list, it exists and is titled "Harry Potter"; but the next record b12346 doesn't exist, but would still show here as "Harry potter"; let's say item 3 in the list is record b12347 titled "Star wars").

This listing is put into $found_items

Now...
Line 309:
// Get MARC for all!
This listing contains just the marc and holdings but NO record numbers. That's why we needed the above listing.
Now, THIS listing does behave correctly, as it only shows existing records. So, in this listing we'd get the marc for "Harry potter" followed by the one for "star wars".

This listing is put into $marc_matches.

SO, the cycle in question tries to sort it all together:
lines 332-335:

// Assign marc to the record data in $found_items
// As mentioned above, $found_items contains some false positives, so check
// the title stored above against the marc data before storing. False 
// positives get sent to the not_found_items array.

What we want to do here is, when we find a mismatch, stop advancing thru $marc_matches and keep going thru $found_items until the titles match up again because $found_items will always have the same or more items than $marc_matches (never less).

I'm guessing this is *by design* but curious to see how this patch worked for you better.

tituomin’s picture

Status: Postponed (maintainer needs more info) » Closed (works as designed)

Ah ok, I see.. I didn't think this through all the way. Because my whole test was based on a bug #726580: Improved comparison of titles in mass import in the first place, I understood the logic wrong. This issue only comes up if the title vs. marc comparison operation itself is faulty, returning false, which is not the same thing as the test being correct and returning false. =) Because in the latter (invalid) case, both arrays should be advancing.

But the good news is that #726580: Improved comparison of titles in mass import seems to cover all my bad cases, at least for the moment. Closing this, sorry about the confusion. =)

janusman’s picture

No problem!!