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

UIU-2966 - display item title and barcode as text for dcb virtual item. #2597

Merged
merged 5 commits into from
Dec 5, 2023

Conversation

Terala-Priyanka
Copy link
Contributor

@Terala-Priyanka Terala-Priyanka commented Nov 27, 2023

Purpose

UIU-2966 - [DCB] Loan details: Disable DCB item links (Borrowing/Pickup library)

Approach

Item title and item barcode are displayed as text (not links) when item instance id and holdings record id are that of DCB instance id and DCB holdings record id.

Screencast

63CuFEWBkb

Learning

Pre-Merge Checklist

Before merging this PR, please go through the following list and take appropriate actions.

  • I've added appropriate record to the CHANGELOG.md
  • Does this PR meet or exceed the expected quality standards?
    • Code coverage on new code is 80% or greater
    • Duplications on new code is 3% or less
    • There are no major code smells or security issues
  • Does this introduce breaking changes?
    • If any API-related changes - okapi interfaces and permissions are reviewed/changed correspondingly
    • There are no breaking changes in this PR.

If there are breaking changes, please STOP and consider the following:

  • What other modules will these changes impact?
  • Do JIRAs exist to update the impacted modules?
    • If not, please create them
    • Do they contain the appropriate level of detail? Which endpoints/schemas changed, etc.
    • Do they have all they appropriate links to blocked/related issues?
  • Are the JIRAs under active development?
    • If not, contact the project's PO and make sure they're aware of the urgency.
  • Do PRs exist for these changes?
    • If so, have they been approved?

Ideally all of the PRs involved in breaking changes would be merged in the same day to avoid breaking the folio-testing environment. Communication is paramount if that is to be achieved, especially as the number of intermodule and inter-team dependencies increase.

While it's helpful for reviewers to help identify potential problems, ensuring that it's safe to merge is ultimately the responsibility of the PR assignee.

@Terala-Priyanka Terala-Priyanka marked this pull request as draft November 27, 2023 13:06
@Terala-Priyanka Terala-Priyanka self-assigned this Nov 27, 2023
@Terala-Priyanka Terala-Priyanka changed the title UIU-2966 - initial commit to display item title and barcode as text f… UIU-2966 - display item title and barcode as text for dcb virtual item. Nov 28, 2023
@Terala-Priyanka Terala-Priyanka marked this pull request as ready for review November 28, 2023 10:05
@Terala-Priyanka Terala-Priyanka requested a review from a team November 28, 2023 10:05
@Dmytro-Melnyshyn Dmytro-Melnyshyn requested a review from a team November 28, 2023 11:17
const instanceId = get(this.loan, ['item', 'instanceId'], '');
const holdingsRecordId = get(this.loan, ['item', 'holdingsRecordId'], '');
const isVirtualItem = isDCBItem({ instanceId, holdingsRecordId });

if (title) {
const titleTodisplay = (title.length >= 77) ? `${title.substring(0, 77)}...` : title;
Copy link
Member

Choose a reason for hiding this comment

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

I know you didn't add this, but while you're here, can you move this magic number to a constant?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

implemented it. I hope this is the way you would suggest it to be.

Copy link
Member

@zburke zburke left a comment

Choose a reason for hiding this comment

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

This is a great start but should handle a11y correctly. I'm glad to see DCB UUIDs stored in constants, but the fact that such constants need to exist at all still gives me the willies.

@@ -43,6 +43,7 @@ import {
accountsMatchStatus,
checkUserActive,
isDcbUser,
isDCBItem,
Copy link
Member

Choose a reason for hiding this comment

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

We need to decide between functions like isDCB... and isDcb.... I know that's not your gaffe, but it's highlighted here by adding the new import.

src/constants.js Outdated
Comment on lines 352 to 353
export const DCB_INSTANCE_ID = '9d1b77e4-f02e-4b7f-b296-3f2042ddac54';
export const DCB_HOLDINGS_RECORD_ID = '10cd3a5a-d36f-4c7a-bc4f-e1ae3cf820c9';
Copy link
Member

Choose a reason for hiding this comment

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

I'm glad to see these values as constants, but to me they feel like the kind of thing that should be provided in an API request like /inventory/dcb-instance-id. I realize that's not on you, but it seems like bad policy to have a bunch of UUIDs copied around inside a bunch of different back-end and front-end modules.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Unfortunately, implementing such an API was not a part of architecture.

src/views/LoanDetails/LoanDetails.js Outdated Show resolved Hide resolved
src/views/LoanDetails/LoanDetails.js Outdated Show resolved Hide resolved
Comment on lines 338 to 342
const itemBarcode = get(loan, ['item', 'barcode'], '');
const isVirtualItem = isDCBItem({ instanceId, holdingsRecordId });

if (isVirtualItem) {
return itemBarcode;
Copy link
Member

Choose a reason for hiding this comment

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

The diff makes it hard to assess, but do you need to handle items without barcodes? If so, set the default value of itemBarcode to <NoValue /> instead of empty string up on line 338.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is not the code that I have written now. It has been restructured by me.

  1. My primary question - is it possible for a loan be created on an item without barcode? I think "NO" in that case, in other words, there can be no loan whose item will not have a barcode. Is that ok to have the default value removed from line 338?
  2. The idea here is no render the item barcode as text (not a link) in case of a dcb item.

Copy link

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

84.0% 84.0% Coverage
0.0% 0.0% Duplication

@Terala-Priyanka Terala-Priyanka merged commit cc017a7 into master Dec 5, 2023
4 checks passed
@Terala-Priyanka Terala-Priyanka deleted the UIU-2966 branch December 5, 2023 09:36
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