wellcomecollection / catalogue-api

:crystal_ball: The API for searching the Wellcome Collection catalogue.
https://developers.wellcomecollection.org
MIT License
4 stars 0 forks source link

Change the way we handle the lookup of unhandled items #638

Closed alexwlchan closed 1 year ago

alexwlchan commented 1 year ago

When the items API is asked to look up an item status, it:

1) fetches the item from Sierra 2) tries to work out what the latest status of the item is

What happens if:

i) we can't fetch the item from Sierra, or ii) we can't work out what the new status should be

We have some logic in the old getUpdatedAccessConditions method which would add a default access condition of 'not requestable', but this drops any context about why – for example, if the catalogue API tells us that an item is not requestable because it's on loan, the items API will lose that descriptive message.

This default access condition was meant for (i) but it was being applied to (ii) also. I'm not entirely sure it's the right behaviour and it was only an edge case anyway, so I've removed it.

I've also added a test for the "item on loan to staff" case, which is what we care about here.

For https://github.com/wellcomecollection/platform/issues/5632