-
Notifications
You must be signed in to change notification settings - Fork 747
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
Update call number field in Primo Normalized XML #3075
base: master
Are you sure you want to change the base?
Conversation
Before fix: Call-number field was taken from '//p:display/p:availlibrary' root in the pnx or '//p:browse/p:callnumber' root in the pnx and that matched primo pnx format. In primoVE the call-number field exists in a differnt root '//p:delivery/p:bestlocation/p:callNumber' in the pnx. After fix: if call-number is empty it will fetch from '//p:delivery/p:bestlocation/p:callNumber'.
This reverts commit 82d526e.
Before fix: Call-number field was taken from '//p:display/p:availlibrary' root in the pnx or '//p:browse/p:callnumber' root in the pnx and that matched primo pnx format. In primoVE the call-number field exists in a differnt root '//p:delivery/p:bestlocation/p:callNumber' in the pnx. After fix: if call-number is empty it will fetch from '//p:delivery/p:bestlocation/p:callNumber'.
Hello, thank you for your first pull request :) A few comments -
|
if (callNumber[i].textContent.search(/\$\$2.+\$/) != -1) { | ||
callArray.push(callNumber[i].textContent.match(/\$\$2\(?(.+?)(?:\s*\))?\$/)[1]); |
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.
It's not very clear to me what these two regular expressions try to do together. If you want to test whether a string matches a pattern, and if it does, retrieve a group from the match, you typically only need to call match()
once and test its return value. If the string doesn't match, it's null
; if it matches, it's an array with captured groups.
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.
Agreed. And if we do want to test whether a regex matches, it's better to use /regex/.test(string)
instead of string.search(/regex/) != -1
.
In this URL when you save to Zotero and show empty fields, call number field is empty: |
if (callNumber[i].textContent.search(/\$\$2.+\$/) != -1) { | ||
callArray.push(callNumber[i].textContent.match(/\$\$2\(?(.+?)(?:\s*\))?\$/)[1]); |
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.
Agreed. And if we do want to test whether a regex matches, it's better to use /regex/.test(string)
instead of string.search(/regex/) != -1
.
This reverts commit 8057ecf.
Is there any updates on this? |
See comments from @zoe-translates and me |
@AbeJellinek I checked all the comments - and I did whatever was requested:
Am I missing out on something? |
The customer is requesting for updates. Can you please review and approve the change being requested |
|
Hi @AbeJellinek @zoe-translates We would like your help in closing this issue, since we have Primo customers that are waiting for this fix. We have already implemented your remarks on the regex. please suggest if possible options to help and speed this up. All the best |
What are those issues?
No, you did not. Or if you did, you haven't pushed it.
What do you mean? |
Before fix:
Call-number field was taken from '//p:display/p:availlibrary' root in the pnx or '//p:browse/p:callnumber' root in the pnx
and that matched primo pnx format.
In primoVE the call-number field exists in a differnt root '//p:delivery/p:bestlocation/p:callNumber' in the pnx.
After fix:
if call-number is empty it will fetch from '//p:delivery/p:bestlocation/p:callNumber'.