Skip to content

Commit

Permalink
Add ILR to the list of 'requestable' libraries.
Browse files Browse the repository at this point in the history
  • Loading branch information
tworrall committed Jul 17, 2020
1 parent f0c3482 commit 433995e
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
21 changes: 14 additions & 7 deletions app/controllers/blacklight_cornell_requests/request_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
module BlacklightCornellRequests

class RequestDatabaseException < StandardError
# :requestable_libraries is a temporary, Covid-19 variable
attr_reader :data

def initialize(data)
Expand Down Expand Up @@ -52,21 +51,29 @@ def magic_request target=''
work_metadata = Work.new(@id, @document)
# Temporary Covid-19 work around: patrons can only make delivery requests from 5 libraries, use
# this string to prevent other locations from appearing in the items array.
requestable_libraries = "Library Annex, Mann Library, Olin Library, Kroch Library Asia, Uris Library"
requestable_libraries = "Library Annex, Mann Library, Olin Library, Kroch Library Asia, Uris Library, ILR Library"
# Create an array of all the item records associated with the bibid
items = []
holdings = JSON.parse(@document['items_json'] || '{}')
# Items are keyed by the associated holding record
holdings.each do |h, item_array|
item_array.each do |i|
items << Item.new(h, i, JSON.parse(@document['holdings_json'])) if (i["active"].nil? || (i["active"].present? && i["active"])) && (i['location']['library'].present? && requestable_libraries.include?(i['location']['library']))

# Somehow a user was able to request an ETAS work though no request button appears in the UI
# for that work -- hacked the URL perhaps. So adding a check to see if the document includes
# the etas_facet. If it does, bypass everything. This is a temporary Covid-19 change. Note:
# customized the alert for this situation in the items.empty? block below.
if @document['etas_facet'].nil? || @document['etas_facet'].empty?
holdings = JSON.parse(@document['items_json'] || '{}')
# Items are keyed by the associated holding record
holdings.each do |h, item_array|
item_array.each do |i|
items << Item.new(h, i, JSON.parse(@document['holdings_json'])) if (i["active"].nil? || (i["active"].present? && i["active"])) && (i['location']['library'].present? && requestable_libraries.include?(i['location']['library']))
end
end
end
# This isn't likely to happen, because the Request item button should be suppressed, but if there's
# a work with only one item and that item is inactive, we need to redirect because the items array
# will be empty.
if items.empty?
flash[:alert] = "There are no items available to request for this title."
flash[:alert] = "This title may not be requested because it is available online." if @document['etas_facet'].present?
redirect_to '/catalog/' + params["bibid"]
return
end
Expand Down
4 changes: 1 addition & 3 deletions app/views/shared/_reqpu.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,13 @@
%select#pickup-locations.form-control{:name => 'library_id'}
%option(value='') -- Select a location --
-# %option{:value => "149", 'data-bd-code': 'F'} Africana Circulation
%option{:value => "157"} Annex Garage Entrance
%option{:value => "151", 'data-bd-code': 'G'} Annex Curbside
%option{:value => "151", 'data-bd-code': 'G'} Annex Garage Entrance
-# %option{:value => '224'} Faculty Department Office
-# %option{:value => "160", 'data-bd-code': 'H'} Fine Arts Circulation
-# %option{:value => "162", 'data-bd-code': 'A'} Geneva Circulation
-# %option{:value => "167", 'data-bd-code': 'I'} ILR Circulation
-# %option{:value => "171", 'data-bd-code': 'B'} Law Circulation
-# %option{:value => "241", 'data-bd-code': 'K'} Management Circulation
%option{:value => "159"} Mann Curbside
%option{:value => "172", 'data-bd-code': 'C'} Mann Lobby
-# %option{:value => "176", 'data-bd-code': 'J'} Math Circulation
-# %option{:value => "179", 'data-bd-code': 'L'} Music Circulation
Expand Down
2 changes: 1 addition & 1 deletion lib/blacklight_cornell_requests/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module BlacklightCornellRequests
VERSION = "3.2.1"
VERSION = "3.2.2"
end
3 changes: 3 additions & 0 deletions release_notes.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Release Notes - blacklight-cornell-requests

## v3.2.2
- Add ILR Library to the list of valid, "requestable" libraries.

## v3.2.1
- Add version number ([5.2]) to migration files.

Expand Down

0 comments on commit 433995e

Please sign in to comment.