Skip to content

Fix item dropdown to show all Items

Latest

Choose a tag to compare

@LineBKreiberg LineBKreiberg released this 23 Nov 08:52

The changes to non-test/doc files ➡️

  • cloudapp/src/app/receive-material/receive-material.component.ts
  • cloudapp/src/app/send-material/send-material.component.ts
  • cloudapp/src/app/shared/alma.service.ts

Changes:

  • Fetch all items from Alma. The dropdown could already show more than ten items. The problem was that we only fetched the first part of the list from Alma. When we asked Alma for the items, holdings and requests on a record, we didn't say how many we wanted, so Alma used its default of 10 per call. We can ask Alma for up to 100 records per call, but not more. So if a holding has more than 100 items, we have to ask several times: first records 1–100, then 101–200, and so on. The new code (getAllPages in alma.service.ts) does this until it has all the items. Most holdings have fewer than 100 items, so this is usually just one call. To be safe, it stops after 1,000 items.
  • Only call /bibs/{id} with an MMS ID. The app also accepts barcodes and MARC 583x values, and some of these were being sent to Alma's bib API, which returned errors. The app now checks that the input looks like an MMS ID (digits starting with 99) before making that call.
  • Smaller fixes in alma.service.ts: errors from the barcode lookup are now passed on as errors instead of as normal values, and a holding with exactly one item is handled correctly.
  • Added extra docs and new tests - and adjusted existing tests.