-
Notifications
You must be signed in to change notification settings - Fork 1
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
Rename "Library ID" to "University ID" #1033
Conversation
feb2bd5
to
373c73a
Compare
989239a
to
57aefe3
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks pretty good. I think it would be better if we put these labels in i18n though.
57aefe3
to
1727350
Compare
1727350
to
e129ae4
Compare
# Look up a patron by barcode and return a Patron object | ||
# If 'patron_info' is false, don't run the full patron info GraphQL query | ||
def find_patron_by_barcode(barcode, patron_info: true) | ||
response = get_json('/users', params: { query: CqlQuery.new(barcode:).to_query }) | ||
user = response.dig('users', 0) | ||
raise ActiveRecord::RecordNotFound, "User with barcode #{barcode} not found" unless user | ||
|
||
patron_info ? Folio::Patron.find(user['id']) : Folio::Patron.new({ 'user' => user }) | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could we keep this, make find_patron_by_university_id
do what it says, and then have a new method that tries the other two methods in sequence? That's clearer to me than having find_patron_by_university_id
the way it is in this PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(I can make this change if others agree)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍🏻
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's fine with me too.. I was trying to leave the code in a "just take these few lines away later" state, but since it sounds like later may be... much later... clarifying it is good too 🤷♂️
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated to do this.
def user_info(user_id) | ||
get_json("/users/#{CGI.escape(user_id)}") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as far as I could tell, this was unused.
# Find a user by barcode in FOLIO; raise an error if not found | ||
def find_user_by_barcode(barcode) | ||
user = get_json('/users', params: { query: CqlQuery.new(barcode:).to_query }).dig('users', 0) | ||
raise ActiveRecord::RecordNotFound, "User with barcode '#{barcode}' not found" unless user | ||
|
||
user | ||
end | ||
|
||
# Find a user by university ID (externalSystemId in FOLIO); raise an error if not found | ||
def find_user_by_university_id(university_id) | ||
user = get_json('/users', params: { query: CqlQuery.new(externalSystemId: university_id).to_query }).dig('users', 0) | ||
raise ActiveRecord::RecordNotFound, "User with externalSystemId '#{university_id}' not found" unless user | ||
|
||
user | ||
end | ||
|
||
# Find a user by sunetid (username in FOLIO); raise an error if not found | ||
def find_user_by_sunetid(sunetid) | ||
user = get_json('/users', params: { query: CqlQuery.new(username: sunetid).to_query }).dig('users', 0) | ||
raise ActiveRecord::RecordNotFound, "User with username '#{sunetid}' not found" unless user | ||
|
||
user | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
these were repeated across the login_by_*
and find_patron_by_*
methods, so I extracted them.
Connects to sul-dlss/SearchWorks#3773 This commit helps us move the access portfolio beyond using library barcode numbers, leaning instead on the university-assigned and -managed "university ID."
…e login/reset forms
92e559f
to
96946ff
Compare
Connects to sul-dlss/SearchWorks#3773
This commit helps us move the access portfolio beyond using library barcode numbers, leaning instead on the university-assigned and -managed "university ID."