Skip to content

Commit

Permalink
Merge pull request #35 from cul-it/DISCOVERYACCESS-5343
Browse files Browse the repository at this point in the history
DISCOVERYACCESS-5343: use badges to distinguish between BD and ILL it…
  • Loading branch information
tworrall authored Nov 20, 2019
2 parents 31a6cb2 + a2738a2 commit 2c4da57
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
27 changes: 24 additions & 3 deletions app/controllers/my_account/account_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,30 @@ def index
# items times out with a nasty server error if the user has too many charged items. For now, arbitrarily
# do this only for small collections of items. (This means that users with large collections won't see the
# warning labels that certain items can't be renewed ... but the renewal process itself should still work.)
Rails.logger.debug("tlw72 > @bd_requests = " + @bd_requests.inspect)
Rails.logger.debug("tlw72 > @checkouts = " + @checkouts.inspect)
Rails.logger.debug("tlw72 > @pending_requests = " + @pending_requests.inspect)

# HACK (tlw72): if the title of a BD request = the title of an item that's checked out but shows
# "voyager" as the system, it's a good bet -- maybe -- that checked out item is a BD request.
# The location (lo) and callnumber (callno) of the checked out item should also be null, so
# check those, too. If all three criteria meet, add a "is_bd" value to the checkout out item to grab
# in the template. Also, if the system is "illiad" or there's a TransactionNumber, we have an ILL item.
# add a "is_ill" value to checkout that can also be grabbed in the template.
if @checkouts.length > 0
@checkouts.each do |chk|
if @bd_requests.length > 0
# there's often (always?) a white space at the end of a BD title in voyager. Lose it.
chk_title = chk["ou_title"].present? ? chk["ou_title"].sub(/\s+\Z/, "") : chk["tl"].sub(/\s+\Z/, "")
bd_array = @bd_requests.select {|book| book["tl"] == chk_title}
if bd_array.length > 0 && chk["lo"].length == 0 && chk["callno"].length == 0
chk["is_bd"] = true
end
end
if chk["system"] == "illiad" || chk["TransactionNumber"].present?
chk["is_ill"] = true
end
end
Rails.logger.debug("tlw72 > @checkouts = " + @checkouts.inspect)
end

if @checkouts.length <= 100
@renewable_lookup_hash = get_renewable_lookup user
end
Expand Down
6 changes: 6 additions & 0 deletions app/views/my_account/account/_checkouts.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,12 @@
- if @renewable_lookup_hash && @renewable_lookup_hash[c['iid']] == 'N'
%div.badge.badge-secondary
This item cannot be renewed.
- if c['is_bd']
%div.badge.badge-primary
Borrow Direct
- if c['is_ill']
%div.badge.badge-success
Interlibrary Loan
%td
=c['au']
%td
Expand Down

0 comments on commit 2c4da57

Please sign in to comment.