Skip to content

Commit

Permalink
Merge changes for v2.2.4 (#105)
Browse files Browse the repository at this point in the history
* Merge changes for v2.1.6 (#92)

* DISCOVERYACCESS-7627 - for rbenv users

* DISCOVERYACCESS-7627 - rails 6 required for cornell-blacklight

* DISCOVERYACCESS-7627 - bump version number

* DISCOVERYACCESS-7627 - rails 6 for cornell-blacklight

* DISCOVERYACCESS-7627 - try rails 7

* DISCOVERYACCESS-7627 - back to rails 6.1

* DISCOVERYACCESS-7627 - bump version number

* DISCOVERYACCESS-7627 - forgot save all

* Update release notes

Co-authored-by: James Reidy <[email protected]>

* DISCOVERYACCESS-7838: update my account login page text

* Merge changes for v2.2.0 (ReShare) to dev (#94)

* WIP

* Eliminate ilsapi cgi script reference (talk directly to illiad6.cgi)

* Display pickup location for BD

* Differentiate pending and available ReShare requests

* Bump to v2.2.0

* Ensure ReShare results are only for the user's netid

* Remove unused functions

* Linting

* Skip ILL items with status 'Request Sent to BD'

* Avoid duplicate request entries

* DISCOVERYACCESS-7964: update links to main site

* DISCOVERYACCESS-7964: update link to fine rates

* Merge changes for v2.2.2 (#97)

* Merge changes for v2.2.1 to master (#96)

* Merge changes for v2.1.6 (#92)

* DISCOVERYACCESS-7627 - for rbenv users

* DISCOVERYACCESS-7627 - rails 6 required for cornell-blacklight

* DISCOVERYACCESS-7627 - bump version number

* DISCOVERYACCESS-7627 - rails 6 for cornell-blacklight

* DISCOVERYACCESS-7627 - try rails 7

* DISCOVERYACCESS-7627 - back to rails 6.1

* DISCOVERYACCESS-7627 - bump version number

* DISCOVERYACCESS-7627 - forgot save all

* Update release notes

Co-authored-by: James Reidy <[email protected]>

* DISCOVERYACCESS-7838: update my account login page text

* Merge changes for v2.2.0 (ReShare) to dev (#94)

* WIP

* Eliminate ilsapi cgi script reference (talk directly to illiad6.cgi)

* Display pickup location for BD

* Differentiate pending and available ReShare requests

* Bump to v2.2.0

* Ensure ReShare results are only for the user's netid

* Remove unused functions

* Linting

* Skip ILL items with status 'Request Sent to BD'

* Avoid duplicate request entries

Co-authored-by: James Reidy <[email protected]>
Co-authored-by: Melissa Wallace <[email protected]>

* Handle 'checked out in FOLIO'

* Don't create catalog links for ReShare items

* Code cleanup

* Don't show ReShare items with status REQ_CHECKED_IN

* Show date shipped for ReShare items in pending requests

* Remove nonfunctional checkbox selection from available requests.

* Restore source badges for ILL items in checkouts list

* Bump to v2.2.2

* Remove debug code

---------

Co-authored-by: James Reidy <[email protected]>
Co-authored-by: Melissa Wallace <[email protected]>

* Fix bug causing requests not to load (#99)

* DISCOVERYACCESS-7511: Strip out YAML alert code (#101)

* DISCOVERYACCESS-8043: Remove link to Borrow Direct resolver script (#102)

* Remove link to Borrow Direct resolver script (DISCOVERYACCESS-8043)

* Remove link to Borrow Direct resolver script (DISCOVERYACCESS-8043)

---------

Co-authored-by: Matthew Connolly <[email protected]>

* DISCOVERYACCESS-8164: Guard against empty ReShare records (#103)

* Guard against empty(ish) ReShare records (DISCOVERYACCESS-8164

* Guard against empty(ish) ReShare records (DISCOVERYACCESS-8164

* Bump to v2.2.4

---------

Co-authored-by: James Reidy <[email protected]>
Co-authored-by: Melissa Wallace <[email protected]>
Co-authored-by: Matthew Connolly <[email protected]>
  • Loading branch information
4 people authored Oct 4, 2023
1 parent b1b62a8 commit 64dfee9
Show file tree
Hide file tree
Showing 6 changed files with 31 additions and 39 deletions.
38 changes: 16 additions & 22 deletions app/controllers/my_account/account_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -59,20 +59,6 @@ def index
end

@netid = user

# Check for alert messages in alerts.yaml
begin
alert_messages = YAML.load_file("#{Rails.root}/alerts.yaml")
# Each message in the YAML file should have a pages array that lists which pages (e.g., MyAccount, Requests)
# should show the alert, and a message property that contains the actual message text/HTML. Only show
# the messages for the proper page.
@alerts = alert_messages.select{|m| m['pages']&.include?('MyAccount')}.map{|m| m['message']}
rescue Errno::ENOENT, Psych::SyntaxError
# Nothing to do here; the alerts file is optional, and its absence (Errno::ENOENT) just means that there
# are no alert messages to show today. Psych::SyntaxError means there was an error in the syntax
# (most likely the indentation) of the YAML file. That's not good, but crashing with an ugly
# error message is worse than not showing the alerts.
end
end

# Return a FOLIO authentication token for API calls -- either from the session if a token
Expand Down Expand Up @@ -362,15 +348,22 @@ def get_bd_requests

# HACK: This is a terrible way to obtain the item title and author. Unfortunately, this information isn't surfaced
# in the API response, but only provided as part of a marcxml description of the entire item record.
title = ''
author = ''
marc = XmlSimple.xml_in(item['bibRecord'])
f245 = marc['GetRecord'][0]['record'][0]['metadata'][0]['record'][0]['datafield'].find { |t| t['tag'] == '245' }
f245a = f245 && f245['subfield'].find { |sf| sf['code'] == 'a' }
f245b = f245 && f245['subfield'].find { |sf| sf['code'] == 'b' }
title = f245b ? "#{f245a['content']} #{f245b['content']}" : f245a['content']

f100 = marc['GetRecord'][0]['record'][0]['metadata'][0]['record'][0]['datafield'].find { |t| t['tag'] == '100' }
f100a = f100 && f100['subfield'].find { |sf| sf['code'] == 'a' }
author = f100a ? "#{f100a['content']}" : ''
record = marc['GetRecord'][0]['record'][0]
# It can happen that, in rare cases, the metadata section is completely missing from the record.
fields = record.dig('metadata', 0, 'record', 0, 'datafield')
if fields
f245 = fields.find { |f| f['tag'] == '245' }
f245a = f245 && f245['subfield'].find { |sf| sf['code'] == 'a' }
f245b = f245 && f245['subfield'].find { |sf| sf['code'] == 'b' }
title = f245b ? "#{f245a['content']} #{f245b['content']}" : f245a['content']

f100 = fields.find { |t| t['tag'] == '100' }
f100a = f100 && f100['subfield'].find { |sf| sf['code'] == 'a' }
author = f100a ? "#{f100a['content']}" : ''
end

# For the final item, we add a fake item ID number (iid) for compatibility with other items in the system
# ReShare status *stages* are defined here:
Expand All @@ -388,6 +381,7 @@ def get_bd_requests
'shipped' => reshare_shipped_status(item)
}
end

session[netid + '_bd_items'] = cleaned_items
render json: cleaned_items
end
Expand Down
9 changes: 2 additions & 7 deletions app/views/my_account/account/_pending_requests.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -51,14 +51,9 @@
%span{:id => 'request-loading-spinner'}


- if has_ill_pending
- if has_ill_pending || has_bd_pending
%p
Need to cancel an Interlibrary loan request? Go to
Need to cancel a Borrow Direct or Interlibrary Loan request? Go to
%a{:href => "https://cornell.hosts.atlas-sys.com/illiad"}
ILLiad
- if has_bd_pending
%p
Need to cancel a Borrow Direct request? Go to
%a{:href => "http://resolver.library.cornell.edu/NET/parsebd?redirect=yes"}
Borrow Direct

8 changes: 0 additions & 8 deletions app/views/my_account/account/index.html.haml
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,6 @@
- if @netid.nil?
%p ERROR: Your account information could not be retrieved. Please ask a librarian for help or report this using the feedback link below.
- else
- if @alerts.present?
%div.service-alert
%div.alert.alert-warning
- @alerts.each do |alert|
%p
= alert.try(:html_safe)
%p
%br
%h2#userName

%ul.nav.nav-tabs{:role => "tablist"}
Expand Down
6 changes: 6 additions & 0 deletions lib/my_account/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,12 @@ class Engine < ::Rails::Engine
config.assets.paths << config.root.join('/engines/my_account/app/assets/javascripts')
config.assets.precompile << "my_account/application.js"
config.assets.precompile << "my_account/account.js.coffee"

config.to_prepare do
# Make the main Blacklight app's helpers available to the engine.
# This is required for the overriding of engine views and helpers to work correctly.
Engine::ApplicationController.helper Rails.application.helpers
end
end

def self.config(&block)
Expand Down
2 changes: 1 addition & 1 deletion lib/my_account/version.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
module MyAccount
VERSION = "2.2.3"
VERSION = "2.2.4"
end
7 changes: 6 additions & 1 deletion release_notes.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
# Release Notes - my-account

## v2.2.4
- Remove link to Borrow Direct resolver script (DISCOVERYACCESS-8043)
- Guard against empty(ish) ReShare records (DISCOVERYACCESS-8164)

## v2.2.3
- Fix bug in shipped date calculation that prevented requests from loading.
- Strip out YAML alert code (use the code in the main Blacklight template instead).
- Fix bug in shipped date calculation that prevented requests from loading (DISCOVERYACCESS-7999).

## v2.2.2
### Improvements
Expand Down

0 comments on commit 64dfee9

Please sign in to comment.