SearchWorks icon indicating copy to clipboard operation
SearchWorks copied to clipboard

Change "latest" to use pieces purchase order line location

Open saseestone opened this issue 2 months ago • 3 comments

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:

Image

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:

Image

And only place the "Latest" statement under that location.

saseestone avatar Oct 02 '25 19:10 saseestone

After the conversation with Irina, Chris raised questions:

  1. 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...
  2. Is the purchase order line location multi-valued? if yes, what should we do?

saseestone avatar Oct 02 '25 19:10 saseestone

  1. 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.
  2. 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
  } ]

trapido avatar Oct 02 '25 20:10 trapido

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

dnoneill avatar Oct 07 '25 19:10 dnoneill