Skip to content
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

Merged
merged 3 commits into from
Apr 2, 2024
Merged

Conversation

mjgiarlo
Copy link
Member

@mjgiarlo mjgiarlo commented Jan 26, 2024

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."

@mjgiarlo mjgiarlo force-pushed the university-id-SearchWorks#3773 branch 3 times, most recently from feb2bd5 to 373c73a Compare January 29, 2024 18:48
@mjgiarlo mjgiarlo force-pushed the university-id-SearchWorks#3773 branch 2 times, most recently from 989239a to 57aefe3 Compare February 28, 2024 17:54
@mjgiarlo mjgiarlo marked this pull request as ready for review February 28, 2024 18:08
Copy link
Contributor

@jcoyne jcoyne left a 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.

config/settings.yml Outdated Show resolved Hide resolved
@mjgiarlo mjgiarlo changed the title Rename "Library ID" to "University ID" [DO NOT MERGE] Rename "Library ID" to "University ID" Feb 28, 2024
@mjgiarlo mjgiarlo force-pushed the university-id-SearchWorks#3773 branch from 57aefe3 to 1727350 Compare February 28, 2024 23:57
@mjgiarlo mjgiarlo requested a review from jcoyne February 28, 2024 23:58
@mjgiarlo mjgiarlo force-pushed the university-id-SearchWorks#3773 branch from 1727350 to e129ae4 Compare February 28, 2024 23:59
@cbeer cbeer changed the title [DO NOT MERGE] Rename "Library ID" to "University ID" Rename "Library ID" to "University ID" Mar 28, 2024
Comment on lines -179 to -184
# 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

Copy link
Member

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

Copy link
Member

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)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏻

Copy link
Member

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 🤷‍♂️

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Updated to do this.

Comment on lines -56 to -57
def user_info(user_id)
get_json("/users/#{CGI.escape(user_id)}")
Copy link
Member

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.

Comment on lines +248 to +267
# 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

Copy link
Member

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.

mjgiarlo and others added 3 commits April 2, 2024 14:47
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."
@thatbudakguy thatbudakguy force-pushed the university-id-SearchWorks#3773 branch from 92e559f to 96946ff Compare April 2, 2024 21:47
@cbeer cbeer merged commit 1f29f96 into main Apr 2, 2024
3 checks passed
@cbeer cbeer deleted the university-id-SearchWorks#3773 branch April 2, 2024 22:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants