Skip to content

Commit

Permalink
add spec requestable override criteria
Browse files Browse the repository at this point in the history
  • Loading branch information
charmingduchess committed Dec 20, 2024
1 parent d64686e commit ef7b80f
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/requestability_resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,21 @@ class RequestabilityResolver {
: 'Missing customer code'
} else if (!itemIsInRecap) {
deliveryInfo = DeliveryLocationsResolver.getOnsiteDeliveryInfo(item)
physRequestableCriteria = `${(deliveryInfo.deliveryLocation &&
deliveryInfo.deliveryLocation.length) || 0} delivery locations.`
physRequestableCriteria = `${(deliveryInfo.deliveryLocation?.length) || 0} delivery locations.`
}
item.specRequestable = this.buildSpecRequestable(item, parentBibHasFindingAid)
item.physRequestable = !!(deliveryInfo.deliveryLocation?.length) && !item.specRequestable
item.physRequestable = !!deliveryInfo.deliveryLocation?.length
item.eddRequestable = !!deliveryInfo.eddRequestable && !item.specRequestable
// items without barcodes should not be requestable
const hasBarcode = (item.identifier || []).some((identifier) => /^(urn|bf):[bB]arcode:\w+/.test(identifier))
if (isItemNyplOwned(item) && !hasBarcode) {
physRequestableCriteria = 'NYPL item missing barcode'
item.physRequestable = false
}
if (item.specRequestable && item.physRequestable) {
item.physRequestable = false
physRequestableCriteria = 'specRequestable overrides physRequestable location'
}
logger.debug(`item ${item.uri}: `, { physRequestable: item.physRequestable, physRequestableCriteria })
item.requestable = [item.eddRequestable || item.physRequestable || item.specRequestable]
return item
Expand Down

0 comments on commit ef7b80f

Please sign in to comment.