Skip to content

Commit

Permalink
Merge pull request #2568 from sul-dlss/illiad-preferred
Browse files Browse the repository at this point in the history
For locations we prefer to send requests to illiad, try illiad no matter what the request type or patron preference.
  • Loading branch information
jcoyne authored Sep 18, 2024
2 parents 25f5bf1 + e091585 commit 60de876
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 2 deletions.
3 changes: 1 addition & 2 deletions app/jobs/submit_patron_request_job.rb
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,9 @@ def perform(patron_request)
def send_to_illiad?(patron_request, item) # rubocop:disable Metrics/CyclomaticComplexity,Metrics/PerceivedComplexity
return true if patron_request.scan?
return false unless patron_request.patron&.ilb_eligible?
return true if item.status == Folio::Item::STATUS_AGED_TO_LOST
return true if item.status == Folio::Item::STATUS_AGED_TO_LOST || item.illiad_preferred?
return false unless patron_request.fulfillment_type == 'recall'
return false unless item.hold_recallable?(patron_request.patron)
return true if item.illiad_preferred?

item.status.in?(illiad_recall_statuses) || item.queue_length.positive?
end
Expand Down
14 changes: 14 additions & 0 deletions spec/jobs/submit_patron_request_job_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,20 @@
end
end

context 'when a pageable item is in a library that we prefer to send to ILLiad' do
before do
allow(bib_data.items[0]).to receive_messages(
hold_recallable?: false,
illiad_preferred?: true
)
end

it 'requests items via ILLiad' do
described_class.perform_now(request)
expect(SubmitIlliadPatronRequestJob).to have_received(:perform_now).with(request, bib_data.items[0].id)
end
end

context 'when the item has a request queue' do
before do
allow(bib_data.items[0]).to receive(:queue_length).and_return(1)
Expand Down

0 comments on commit 60de876

Please sign in to comment.