Skip to content

Commit

Permalink
Merge upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
nonword committed Jun 24, 2024
2 parents b715121 + 7ba2b9d commit 62c4296
Show file tree
Hide file tree
Showing 65 changed files with 2,841 additions and 146,759 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -206,3 +206,4 @@ There is currently one feature flag in this app, which is 'no-on-site-edd'. When
NB: numAvailable and numItem*Parsed counts do not **exclude** the e-item, but these items are not indexed with statuses, volumes, or date ranges, and are therefore not actually included in this count.

NB: As the table above indicates, there is a mismatch between what the front end and API regard as "electronic items". As far as the API is concerned, there is only at most ONE electronic item, which can have many electronic locator values. `numElectronicResources` counts these locator values, but the other item count values treat all the electronic resources as a single item.

9 changes: 2 additions & 7 deletions data/onsite-edd-criteria.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,19 +34,15 @@
"maf",
"maf82",
"maf92",
"maff1",
"maff3",
"mag",
"mag82",
"mag92",
"magg1",
"magg2",
"magg3",
"magh1",
"mai",
"mai82",
"mai92",
"maii1",
"maii2",
"maii3",
"maj92",
Expand All @@ -57,21 +53,21 @@
"mal72",
"mal82",
"mal92",
"mall1",
"malm2",
"malv2",
"map",
"map82",
"map92",
"mapp1",
"mapp2",
"mapp3",
"mas62",
"mas82",
"mas92",
"pad22",
"pad32",
"pam22",
"pah",
"pah22",
"pah32",
"pam",
"pam32",
Expand All @@ -80,7 +76,6 @@
"pat22",
"pat32",
"scf",
"scff1",
"scff2",
"scff3"
]
Expand Down
11 changes: 10 additions & 1 deletion lib/delivery-locations-resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,16 @@ class DeliveryLocationsResolver {
// location is not requestable:
let deliveryLocation
let eddRequestable
if (!isItemNyplOwned(item) || this.requestableBasedOnHoldingLocation(item)) {
const hasRecapCustomerCode = item.recapCustomerCode && item.recapCustomerCode[0]
const nyplItem = isItemNyplOwned(item)
if (!hasRecapCustomerCode) {
const requestableBasedOnHoldingLocation = nyplItem ? this.requestableBasedOnHoldingLocation(item) : true
// the length of the list of delivery locations is checked later to determine physical requestability
// In case of an offsite item with no recap customer code, we want this to be based on holding location
// so we put a placeholder '' in case it is requestable based on holding location
deliveryLocation = requestableBasedOnHoldingLocation ? [''] : []
eddRequestable = requestableBasedOnHoldingLocation
} else if (!nyplItem || this.requestableBasedOnHoldingLocation(item)) {
deliveryLocation = this.deliveryLocationsByRecapCustomerCode(item.recapCustomerCode[0])
eddRequestable = this.__eddRequestableByCustomerCode(item.recapCustomerCode[0])
} else {
Expand Down
13 changes: 6 additions & 7 deletions lib/requestability_resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@ class RequestabilityResolver {
const itemIsInRecap = isInRecap(item)
let physRequestableCriteria
const hasRecapCustomerCode = item.recapCustomerCode && item.recapCustomerCode[0]
if (itemIsInRecap && !hasRecapCustomerCode) {
if (itemIsInRecap) {
// recap items missing codes should default to true for phys and edd
// requestable.
physRequestableCriteria = 'Missing customer code'
deliveryInfo = { eddRequestable: true, deliveryLocation: [''] }
} else if (itemIsInRecap && hasRecapCustomerCode) {
// requestable, unless it has a non-requestable holding location
deliveryInfo = DeliveryLocationsResolver.getRecapDeliveryInfo(item)
physRequestableCriteria = `${(deliveryInfo.deliveryLocation &&
deliveryInfo.deliveryLocation.length) || 0} delivery locations.`
physRequestableCriteria = hasRecapCustomerCode
? `${(deliveryInfo.deliveryLocation &&
deliveryInfo.deliveryLocation.length) || 0} delivery locations.`
: 'Missing customer code'
} else if (!itemIsInRecap) {
deliveryInfo = DeliveryLocationsResolver.getOnsiteDeliveryInfo(item)
physRequestableCriteria = `${(deliveryInfo.deliveryLocation &&
Expand Down
6 changes: 4 additions & 2 deletions lib/resources.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ const SEARCH_SCOPES = {
'uniformTitle.folded',
'parallelUniformTitle',
'formerTitle',
'addedAuthorTitle',
'placeOfPublication',
{ field: 'items.idBarcode', on: (q) => /\d{6,}/.test(q) }
]
Expand All @@ -104,7 +105,8 @@ const SEARCH_SCOPES = {
'parallelTitleAlt.folded',
'parallelCreatorLiteral.folded',
'parallelUniformTitle',
'formerTitle'
'formerTitle',
'addedAuthorTitle'
]
},
contributor: {
Expand Down Expand Up @@ -870,7 +872,7 @@ const buildElasticBody = function (params) {
query
}
}
body.min_score = 1.65
body.min_score = 2.65

// just filters: no score
} else {
Expand Down
24 changes: 22 additions & 2 deletions test/delivery-locations-resolver.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ const sampleItems = {
],
holdingLocation: [
{
id: 'loc:scff3',
id: 'loc:scff2',
prefLabel: 'Schomburg Center - Research & Reference - Desk'
}
],
Expand Down Expand Up @@ -46,7 +46,7 @@ const sampleItems = {
uri: 'i12227153',
holdingLocation: [
{
id: 'loc:scff1',
id: 'loc:scf',
label: 'Schomburg Center - Research & Reference'
}
],
Expand Down Expand Up @@ -530,4 +530,24 @@ describe('Delivery-locations-resolver', function () {
).to.equal(true)
})
})
describe('getRecapDeliveryInfo', function () {
it('returns empty deliveryLocation and eddRequestable false based on holding location when missing recapCustomerCode', function () {
const resolved = DeliveryLocationsResolver.getRecapDeliveryInfo({
holdingLocation: [{ id: 'loc:rccd8' }],
uri: 'i14747243'
})
expect(resolved.deliveryLocation.length).to.equal(0)
expect(resolved.eddRequestable).to.equal(false)
})

it('returns empty string delivery location and eddRequestable true based on holding location when missing recapCustomerCode', function () {
const resolved = DeliveryLocationsResolver.getRecapDeliveryInfo({
holdingLocation: [{ id: 'loc:rcpm2' }],
uri: 'i14747243'
})
expect(resolved.deliveryLocation.length).to.equal(1)
expect(resolved.deliveryLocation[0]).to.equal('')
expect(resolved.eddRequestable).to.equal(true)
})
})
})
Loading

0 comments on commit 62c4296

Please sign in to comment.