Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[#4356] Remove cdl references #4610

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 0 additions & 10 deletions app/helpers/holdings_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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:))
Expand Down Expand Up @@ -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,
Expand Down
16 changes: 1 addition & 15 deletions app/javascript/orangelight/availability.es6
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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}']`
Expand Down
4 changes: 0 additions & 4 deletions docs/orangelight-figgy.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

21 changes: 0 additions & 21 deletions spec/features/availability_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/fixtures/bibdata/availability.json
Original file line number Diff line number Diff line change
@@ -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"}}}
{"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"}}}
186 changes: 0 additions & 186 deletions spec/javascript/orangelight/availability.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
},
Expand All @@ -167,7 +166,6 @@ describe('AvailabilityUpdater', function () {
label: 'Engineering Library - Stacks',
status_label: 'Available',
copy_number: null,
cdl: false,
temp_location: false,
id: '22732100160006421',
},
Expand Down Expand Up @@ -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 =
'<table><tr>' +
'<td class="holding-status" data-availability-record="true" data-record-id="9965126093506421" data-holding-id="22202918790006421" data-aeon="false">' +
'<span class="availability-icon"></span>' +
'</td>' +
'</tr></table>';
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', () => {
Expand Down Expand Up @@ -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',
},
Expand All @@ -395,7 +361,6 @@ describe('AvailabilityUpdater', function () {
label: 'Engineering Library - Stacks',
status_label: 'Available',
copy_number: null,
cdl: false,
temp_location: false,
id: '22732100160006421',
},
Expand All @@ -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 =
'<table><tr>' +
'<td class="holding-status" data-availability-record="true" data-record-id="9965126093506421" data-holding-id="22202918790006421" data-aeon="false">' +
'<span class="availability-icon"></span>' +
'</td>' +
'</tr></table>';
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 =
'<table><tr>' +
Expand All @@ -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',
},
Expand Down Expand Up @@ -499,7 +432,6 @@ describe('AvailabilityUpdater', function () {
label: 'ReCAP - Remote Storage',
status_label: 'Available',
copy_number: null,
cdl: false,
temp_location: false,
id: '22488152160006421',
},
Expand All @@ -516,120 +448,6 @@ describe('AvailabilityUpdater', function () {
);
});

test('extra Online availability added for CDL records that are reported as unavailable', () => {
document.body.innerHTML =
'<ul>' +
' <li data-availability-record="true" data-record-id="9965126093506421" data-holding-id="22202918790006421" data-aeon="false">' +
' <span class="availability-icon"></span>' +
' <div class="library-location" data-location="true" data-record-id="9965126093506421" data-holding-id="22202918790006421">' +
' <span class="results_location">Firestone Library - Stacks</span> » ' +
' <span class="call-number">PS3558.A62424 B43 2010 ' +
' <a title="Where to find it" class="find-it" data-map-location="firestone$stacks" data-blacklight-modal="trigger" ' +
' aria-label="Where to find it" href="/catalog/9965126093506421/stackmap?loc=firestone$stacks&amp;cn=PS3558.A62424 B43 2010">' +
' <span class="fa fa-map-marker" aria-hidden="true"></span>' +
' </a>' +
' </span>' +
' </div>' +
' </li>' +
' <li>' +
' <span class="badge bg-primary" data-availability-cdl="true"></span>' +
' </li>' +
' <li class="empty" data-record-id="9965126093506421">' +
' <a class="availability-icon more-info" title="Click on the record for full availability info" href="/catalog/9965126093506421"></a>' +
' </li>' +
'</ul>';

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 =
'<table><tbody>' +
'<tr class="holding-block">' +
' <td class="library-location" data-holding-id="22745424290006421">' +
' <span class="location-text" data-location="true" data-holding-id="22745424290006421">Firestone Library - Firestone Library</span>' +
' <a title="Where to find it" class="find-it" data-map-location="firestone$stacks" data-blacklight-modal="trigger"' +
' data-call-number="HB172 .G664 2016" data-library="Firestone Library"' +
' href="/catalog/9999490563506421/stackmap?loc=firestone$stacks&amp;cn=HB172 .G664 2016">' +
' <span class="link-text">Where to find it</span>' +
' <span class="fa fa-map-marker" aria-hidden="true"></span>' +
' </a>' +
' </td>' +
' <td class="holding-call-number">HB172 .G664 2016' +
' <a class="browse-cn" title="Browse: HB172 .G664 2016"' +
' data-original-title="Browse: HB172 .G664 2016" href="/browse/call_numbers?q=HB172+.G664+2016">' +
' <span class="link-text">Browse related items</span>' +
' <span class="icon-bookslibrary"></span>' +
' </a>' +
' </td>' +
' <td class="holding-status" data-availability-record="true" data-record-id="9999490563506421"' +
' data-holding-id="22745424290006421" data-aeon="false">' +
' <span class="availability-icon badge " title=""></span>' +
' </td>' +
' <td class="location-services service-conditional" data-open="true" data-requestable="true" data-aeon="false"' +
' data-holding-id="22745424290006421"></td>' +
' <td class="holding-details">' +
' <ul class="item-status" data-record-id="9999490563506421" data-holding-id="22745424290006421"></ul>' +
' </td>' +
'</tr>' +
'</tbody></table>';

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 =
'<table class="availability-table">' +
Expand Down Expand Up @@ -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',
},
Expand Down Expand Up @@ -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',
},
Expand Down Expand Up @@ -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',
},
Expand Down Expand Up @@ -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',
},
Expand Down
Loading