Change "latest" to use pieces purchase order line location
We've gotten feedback (SW-4543) that we're displaying "Latest" for too many holdings when a serial moves locations (e.g. Green to SAL3)
Example record: https://searchworks.stanford.edu/view/8619054. In this example, receiving staff changed the holdings for the order to SAL3 (away from Green), so all newly received materials should be checked in for SAL3 and therefore any "Latest" statements should display under the SAL3 location.
But we have it displaying under Green and SAL3:
In this instance, we should only be displaying the "Latest" under SAL3 only. The Green data is outdated.
Irina explained to Chris, Steve, and I that we should be looking at the pieces purchase order line location (to determine what location to display "Latest") instead of the pieces holding location.
So we should look here:
And only place the "Latest" statement under that location.
After the conversation with Irina, Chris raised questions:
- What should happen when the purchase order line location has changed but the new location hasn't received any items yet? We're assuming "Latest" should continue to display on the "old" location until something is checked in...
- Is the purchase order line location multi-valued? if yes, what should we do?
- How would SearchWorks know which "old" location to show latest on, especially if there are multiple "old" locations, and none of them is linked to the POL? The only solution I can think of is that staff shouldn’t change the location in the POL until they have an item to receive. Then, the latest received will move together with the POL.
- Yes, the POL location is an array that can have multiple values. For ongoing orders, the only time there would be multiple holdings is in the case of print+electronic order (orderFormat = P/E Mix), but the second holding will be electronic, see https://folio.stanford.edu/orders/lines/view/8780695f-ff53-464a-8e7c-09ed69b9e5da, for example:
"locations" : [ {
"holdingId" : "d26b5a4c-5989-5a2b-b31c-3c7d41d585a5",
"quantity" : 1,
"quantityPhysical" : 1
}, {
"holdingId" : "ca095026-291b-54e8-9b1b-b442a9d1828a",
"quantity" : 1,
"quantityElectronic" : 1
} ]
I think https://github.com/sul-dlss/searchworks_traject_indexer/blob/66471d74c6b9b97620b117a43a8677b2da783fe5/lib/traject/readers/folio_postgres_reader.rb#L309-L321 needs to be updated to include locationId