Skip to content

Commit

Permalink
Merge branch 'main' into qa-node20
Browse files Browse the repository at this point in the history
  • Loading branch information
nonword committed Apr 11, 2024
2 parents 13c383a + 6ad77e0 commit e865d3c
Show file tree
Hide file tree
Showing 67 changed files with 76,485 additions and 116,038 deletions.
2 changes: 1 addition & 1 deletion config/test.env
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ NYPL_CORE_VERSION=v2.14
LOG_LEVEL=error
FEATURES=on-site-edd

SEARCH_ITEMS_SIZE=100
SEARCH_ITEMS_SIZE=3
PORT=5678

HIDE_NYPL_SOURCE=
Expand Down
3 changes: 2 additions & 1 deletion data/onsite-edd-criteria.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"status": [
"a"
"a",
"na"
],
"accessMessage": [
"-",
Expand Down
2 changes: 2 additions & 0 deletions lib/delivery-locations-resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,8 @@ class DeliveryLocationsResolver {
const eddCriteriaChecks = [
// Check the following properties for agreement with required values
// rm status because we have separated availability and requestability - VK 7/27/2023
// Add status because status 'o' actually makes holds impossible - PB 3/21/2024
'status',
'catalogItemType',
'holdingLocation',
'accessMessage'
Expand Down
6 changes: 1 addition & 5 deletions lib/requestability_resolver.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const DeliveryLocationsResolver = require('./delivery-locations-resolver')
const { isItemNyplOwned } = require('./ownership_determination')
const { isInRecap, isInSchomburg, getSchomburgDeliveryInfo } = require('./util')
const { isInRecap } = require('./util')
const logger = require('./logger')
class RequestabilityResolver {
static fixItemRequestability (elasticSearchResponse) {
Expand All @@ -26,10 +26,6 @@ class RequestabilityResolver {
physRequestableCriteria = `${(deliveryInfo.deliveryLocation &&
deliveryInfo.deliveryLocation.length) || 0} delivery locations.`
}
if (isInSchomburg(item)) {
deliveryInfo = getSchomburgDeliveryInfo(item, deliveryInfo)
physRequestableCriteria = deliveryInfo.criteria
}
item.eddRequestable = !!deliveryInfo.eddRequestable
item.physRequestable = !!(deliveryInfo.deliveryLocation &&
deliveryInfo.deliveryLocation.length)
Expand Down
8 changes: 6 additions & 2 deletions lib/resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,10 @@ const SEARCH_SCOPES = {
'parallelTitleAlt.folded',
'parallelSeriesStatement.folded',
'parallelCreatorLiteral.folded',
'parallelPublisher'
'parallelPublisher',
'uniformTitle.folded',
'parallelUniformTitle',
'formerTitle'
]
},
title: {
Expand All @@ -98,7 +101,8 @@ const SEARCH_SCOPES = {
'parallelSeriesStatement.folded',
'parallelTitleAlt.folded',
'parallelCreatorLiteral.folded',
'parallelUniformTitle'
'parallelUniformTitle',
'formerTitle'
]
},
contributor: {
Expand Down
25 changes: 0 additions & 25 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -360,28 +360,3 @@ exports.isInRecap = (item) => {
exports.itemHasRecapHoldingLocation(item) ||
!isItemNyplOwned(item)
}

exports.isInSchomburg = (item) => {
const holdingLocation = exports.deepValue(item, 'holdingLocation[0].id')
if (holdingLocation) {
return holdingLocation.startsWith('loc:sc')
}
}

exports.getSchomburgDeliveryInfo = (item, deliveryInfo) => {
const itemType = exports.deepValue(item, 'catalogItemType[0].id')
if (itemType) {
const itemNumber = itemType.split(':')[1]
const holdingLocation = exports.deepValue(item, 'holdingLocation[0].id')
const case1 = holdingLocation === 'loc:scff3' && itemNumber === '26'
const case2 = holdingLocation === 'loc:scff2' && itemNumber === '6'
let criteria
if (case1) criteria = 'scff3 microfiche'
else if (case2) criteria = 'scff2 microfilm'
else {
deliveryInfo.deliveryLocation = []
criteria = 'Non requestable schomburg catalog item type ' + itemNumber
}
return Object.assign({}, deliveryInfo, { criteria })
}
}
2 changes: 1 addition & 1 deletion test/delivery-locations-resolver.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -309,7 +309,7 @@ describe('Delivery-locations-resolver', function () {
})

it('will return true for on-site item failing status check', function () {
item.status[0].id = 'status:co'
item.status[0].id = 'status:na'
expect(DeliveryLocationsResolver.eddRequestableByOnSiteCriteria(item)).to.equal(true)
})

Expand Down
Loading

0 comments on commit e865d3c

Please sign in to comment.