From 69ddde589a40415b117609930c19a28493a492f9 Mon Sep 17 00:00:00 2001 From: Vivian Ha Date: Tue, 3 Dec 2024 11:05:10 -0500 Subject: [PATCH] [#4356] Remove cdl references --- app/helpers/holdings_helper.rb | 10 - app/javascript/orangelight/availability.es6 | 16 +- docs/orangelight-figgy.md | 4 - spec/features/availability_spec.rb | 21 -- spec/fixtures/bibdata/availability.json | 2 +- .../orangelight/availability.spec.js | 186 ------------------ 6 files changed, 2 insertions(+), 237 deletions(-) diff --git a/app/helpers/holdings_helper.rb b/app/helpers/holdings_helper.rb index e9d4d80bc..cd042fb4b 100644 --- a/app/helpers/holdings_helper.rb +++ b/app/helpers/holdings_helper.rb @@ -13,7 +13,6 @@ def holding_block_search(document) holdings_hash.first(2).each do |id, holding| block << first_two_holdings_block(document, id, holding) - block << content_tag(:li, cdl_placeholder) end block << controller.view_context.render(Holdings::OnlineHoldingsComponent.new(document:)) @@ -157,15 +156,6 @@ def holding_status_li(accumulator, document, check_availability, id, holding) ) end - def cdl_placeholder - content_tag( - :span, - '', - class: 'badge bg-primary', - data: { 'availability-cdl': true } - ) - end - def view_record_for_full_avail_li(document) content_tag( :li, diff --git a/app/javascript/orangelight/availability.es6 b/app/javascript/orangelight/availability.es6 index 0bd78f20b..dd0709346 100644 --- a/app/javascript/orangelight/availability.es6 +++ b/app/javascript/orangelight/availability.es6 @@ -219,7 +219,7 @@ export default class AvailabilityUpdater { const result = []; for (const holding_id in holding_records[id]) { const availability_info = holding_records[id][holding_id]; - const { label, cdl } = holding_records[id][holding_id]; + const { label } = holding_records[id][holding_id]; // case :constituent with host ids. // data-record-id has a different this.id when there are host ids. let availability_element; @@ -245,9 +245,6 @@ export default class AvailabilityUpdater { availability_info, false ); - if (cdl) { - insert_online_link(); - } result.push(this.update_request_button(holding_id, availability_info)); } return result; @@ -365,17 +362,6 @@ export default class AvailabilityUpdater { }); } - update_request_button(holding_id, availability_info) { - const { cdl } = availability_info; - const location_services_element = $( - `.location-services[data-holding-id='${holding_id}'] a` - ); - // if it's on CDL then it can't be requested - if (cdl) { - location_services_element.remove(); - } - } - apply_scsb_record(barcode, item_data) { const availability_element = $( `*[data-scsb-availability='true'][data-scsb-barcode='${barcode}']` diff --git a/docs/orangelight-figgy.md b/docs/orangelight-figgy.md index bb10c1874..78ad64f4e 100644 --- a/docs/orangelight-figgy.md +++ b/docs/orangelight-figgy.md @@ -26,7 +26,3 @@ Orangelight uses the bibid from the data attribute and invokes an async graphql * In the electronic_access_1_display we build the catalog domain urls by using the figgy_ark_cache. This is happening during indexing. _Notes_: The rake task to update the figgy_ark_cache errors. The figgy_ark_cache has not been updated since voyager and still includes voyager ids. As a result the catalog domain urls that are structured and indexed during indexing time in the 'electronic_access_1display' have the voyager id. The user clicks on the Digital Content and a new record page will open because it tries to resolve the voyager id to an alma id. - -### CDL item viewer -* Similar to step 1, if there is a scanned resource in Figgy, Orangelight returns the viewer. CDL items are accessible only through CAS and for specific patron groups; this is handled in Figgy. [Figgy's eligible item service](https://github.com/pulibrary/figgy/blob/main/app/services/cdl/eligible_item_service.rb#L4) will do a check to see if the specific item is on cdl. If the item is on cdl it will allow the user to charge or hold it. - diff --git a/spec/features/availability_spec.rb b/spec/features/availability_spec.rb index 12b829a5e..4c5cbaaf1 100644 --- a/spec/features/availability_spec.rb +++ b/spec/features/availability_spec.rb @@ -67,27 +67,6 @@ end end - # This test is quite brittle and will break once this item is removed from - # CDL. It seems valid to remove it if it hasn't been refactored by then, and - # at least create an issue to replace it with a jest test during a refactor of - # this javascript. - - # this item is no longer on CDL - xdescribe 'An item reserved for controlled digital lending', js: true do - before do - stub_holding_locations - visit '/catalog/9976990033506421' - end - - it 'adds a link to the digital object', unless: in_ci? do - expect(page).to have_selector('.availability--online a', count: 1) - expect(page).to have_selector('h3', text: "Available Online") - expect(page).to have_selector('li', text: "Princeton users: View digital content") - expect(page).to have_selector('.holding-status', text: "Reserved for digital lending", exact_text: true) - expect(page).not_to have_selector('a.request') - end - end - # This item is no longer in a temp location xdescribe 'Physical Holdings in temp locations', js: true do it 'displays temp location on search results along with call number', unless: in_ci? do diff --git a/spec/fixtures/bibdata/availability.json b/spec/fixtures/bibdata/availability.json index 754dbb4bc..de705510c 100644 --- a/spec/fixtures/bibdata/availability.json +++ b/spec/fixtures/bibdata/availability.json @@ -1 +1 @@ -{"9946093213506421":{"22258298950006421":{"on_reserve":"N","location":"rare$whs","label":"Special Collections - William H. Scheide Library","status_label":"Available","copy_number":null,"cdl":false,"temp_location":false,"id":"22258298950006421"},"22258298920006421":{"on_reserve":"N","location":"rare$whs","label":"Special Collections - William H. Scheide Library","status_label":"Available","copy_number":null,"cdl":false,"temp_location":false,"id":"22258298920006421"}}} \ No newline at end of file +{"9946093213506421":{"22258298950006421":{"on_reserve":"N","location":"rare$whs","label":"Special Collections - William H. Scheide Library","status_label":"Available","copy_number":null,"temp_location":false,"id":"22258298950006421"},"22258298920006421":{"on_reserve":"N","location":"rare$whs","label":"Special Collections - William H. Scheide Library","status_label":"Available","copy_number":null,"temp_location":false,"id":"22258298920006421"}}} \ No newline at end of file diff --git a/spec/javascript/orangelight/availability.spec.js b/spec/javascript/orangelight/availability.spec.js index 2376515b7..639a7c3c5 100644 --- a/spec/javascript/orangelight/availability.spec.js +++ b/spec/javascript/orangelight/availability.spec.js @@ -157,7 +157,6 @@ describe('AvailabilityUpdater', function () { label: 'Lewis Library - Term Loan Reserves', status_label: 'Available', copy_number: null, - cdl: false, temp_location: true, id: 'lewis$resterm', }, @@ -167,7 +166,6 @@ describe('AvailabilityUpdater', function () { label: 'Engineering Library - Stacks', status_label: 'Available', copy_number: null, - cdl: false, temp_location: false, id: '22732100160006421', }, @@ -281,37 +279,6 @@ describe('AvailabilityUpdater', function () { expect(badge.textContent).toEqual('Some items not available'); }); - test('record show page with an item on CDL adds link to viewer', () => { - document.body.innerHTML = - '' + - '' + - '
' + - '' + - '
'; - const holding_records = { - '9965126093506421': { - '22202918790006421': { - on_reserve: 'N', - location: 'firestone$stacks', - label: 'Stacks', - status_label: 'Unavailable', - cdl: true, - holding_type: 'physical', - id: '22202918790006421', - }, - }, - }; - - const spy = jest.spyOn(orangelight_online_link, 'insert_online_link'); - - const u = new updater(); - u.id = '9965126093506421'; - u.process_single(holding_records); - - expect(spy).toHaveBeenCalled(); - spy.mockRestore(); - }); - // Make sure that the code to handle undetermined availability status updates // the HTML correctly. test('undetermined availability for show page', () => { @@ -385,7 +352,6 @@ describe('AvailabilityUpdater', function () { label: 'Lewis Library - Term Loan Reserves', status_label: 'Available', copy_number: null, - cdl: false, temp_location: true, id: 'lewis$resterm', }, @@ -395,7 +361,6 @@ describe('AvailabilityUpdater', function () { label: 'Engineering Library - Stacks', status_label: 'Available', copy_number: null, - cdl: false, temp_location: false, id: '22732100160006421', }, @@ -417,37 +382,6 @@ describe('AvailabilityUpdater', function () { expect(badge_second.textContent).toEqual('Available'); }); - test('record show page with an item not on CDL does not add a link', () => { - document.body.innerHTML = - '' + - '' + - '
' + - '' + - '
'; - const holding_records = { - '9965126093506421': { - '22202918790006421': { - on_reserve: 'N', - location: 'firestone$stacks', - label: 'Stacks', - status_label: 'Unavailable', - cdl: false, - holding_type: 'physical', - id: '22202918790006421', - }, - }, - }; - - const spy = jest.spyOn(orangelight_online_link, 'insert_online_link'); - - const u = new updater(); - u.id = '9965126093506421'; - u.process_single(holding_records); - - expect(spy).not.toHaveBeenCalled(); - spy.mockRestore(); - }); - test('record show page for a bound-with record', () => { document.body.innerHTML = '' + @@ -464,7 +398,6 @@ describe('AvailabilityUpdater', function () { label: 'ReCAP - ReCAP - rcppa RECAP', status_label: 'Available', copy_number: null, - cdl: false, temp_location: false, id: '22488152160006421', }, @@ -499,7 +432,6 @@ describe('AvailabilityUpdater', function () { label: 'ReCAP - Remote Storage', status_label: 'Available', copy_number: null, - cdl: false, temp_location: false, id: '22488152160006421', }, @@ -516,120 +448,6 @@ describe('AvailabilityUpdater', function () { ); }); - test('extra Online availability added for CDL records that are reported as unavailable', () => { - document.body.innerHTML = - ''; - - const availability_response = { - '9965126093506421': { - '22202918790006421': { - on_reserve: 'N', - location: 'firestone$stacks', - label: 'Firestone Library - Stacks', - status_label: 'Unavailable', - copy_number: null, - cdl: true, - temp_location: false, - id: '22202918790006421', - }, - }, - }; - const holding_data = - availability_response['9965126093506421']['22202918790006421']; - - const cdl_element = $("*[data-availability-cdl='true']")[0]; - const av_element = $( - `*[data-availability-record='true'][data-record-id='9965126093506421'][data-holding-id='22202918790006421'] .availability-icon` - ); - - const u = new updater(); - u.id = '9965126093506421'; - - expect(cdl_element.textContent).not.toContain('Online'); - u.apply_availability_label(av_element, holding_data, true); - expect(cdl_element.textContent).toContain('Online'); - }); - - test('in the Show page we display Online instead of Unavailable for CDL records', () => { - document.body.innerHTML = - '
' + - '' + - ' ' + - ' ' + - ' ' + - ' ' + - ' ' + - '' + - '
' + - ' Firestone Library - Firestone Library' + - ' ' + - ' Where to find it' + - ' ' + - ' ' + - ' HB172 .G664 2016' + - ' ' + - ' Browse related items' + - ' ' + - ' ' + - ' ' + - ' ' + - ' ' + - '
    ' + - '
    '; - - const availability_response = { - '9999490563506421': { - '22745424290006421': { - on_reserve: 'N', - location: 'firestone$stacks', - label: 'Firestone Library - Firestone Library', - status_label: 'Unavailable', - copy_number: null, - cdl: true, - temp_location: false, - id: '22745424290006421', - }, - }, - }; - - const holding_data = - availability_response['9999490563506421']['22745424290006421']; - - const av_element = $( - `*[data-availability-record='true'][data-record-id='9999490563506421'][data-holding-id='22745424290006421'] .availability-icon` - ); - const u = new updater(); - u.id = '9999490563506421'; - - expect(av_element[0].textContent).not.toContain('Online'); - u.apply_availability_label(av_element, holding_data, false); - expect(av_element[0].textContent).toContain('Online'); - }); - test('special case for Marquand locations - marquand$stacks,marquand$pj,marquand$ref,marquand$ph,marquand$fesrf - items to display status: Ask Staff', () => { document.body.innerHTML = '' + @@ -661,7 +479,6 @@ describe('AvailabilityUpdater', function () { 'Marquand Library - Remote Storage (ReCAP): Marquand Library Use Only', status_label: 'Unavailable', copy_number: null, - cdl: false, temp_location: false, id: '22642015240006421', }, @@ -705,7 +522,6 @@ describe('AvailabilityUpdater', function () { label: 'Resource Sharing Library - Lending Resource Sharing Requests', status_label: 'Unavailable', copy_number: null, - cdl: false, temp_location: true, id: 'RES_SHARE$IN_RS_REQ', }, @@ -836,7 +652,6 @@ describe('AvailabilityUpdater', function () { label: 'Resource Sharing Library - Lending Resource Sharing Requests', status_label: 'Unavailable', copy_number: null, - cdl: false, temp_location: true, id: 'RES_SHARE$IN_RS_REQ', }, @@ -897,7 +712,6 @@ describe('AvailabilityUpdater', function () { label: 'Resource Sharing Library - Lending Resource Sharing Requests', status_label: 'Unavailable', copy_number: null, - cdl: false, temp_location: true, id: 'RES_SHARE$IN_RS_REQ', },