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

MODORDERS -1087 Delete received pieces in bulk #905

Open
wants to merge 35 commits into
base: master
Choose a base branch
from

Conversation

yuntianhu
Copy link
Contributor

Purpose: Libraries that use the Receiving app for receipt of print serials may wish to delete pieces that precede a specific date. Currently, FOLIO supports the deletion of pieces, but one at a time. When a library wishes to purge receiving records for multiple years on an ongoing workflow, the ability to delete pieces in bulk will streamline this workflow.

Weeding old journal issues; receiving records no longer necessary since items have been withdrawn

User story statement(s):

As a serials librarian,
I want to delete multiple pieces at one time
so that the continuous addition of pieces does not eventually impact performance of the Receiving app.

Scenarios:

Bulk edit received/expected pieces:

Given user has received multiple piece records for a given receiving title

When expanding received/expected pieces accordion

Then user has option in action menu for Bulk edit

Select one or more pieces:

Given user clicks Bulk edit

When toggles appear in table

Then user can select one or more pieces

Edit pieces:

Given user has selected one or more pieces

When user clicks edit piece button

Then Bulk edit piece form is displayed

Delete all pieces

Given user clicks edit piece button

When Bulk edit piece form is displayed

Then "Delete all" button is active

Delete all pieces confirmation

Given user is viewing Bulk edit piece form

When user clicks "Delete all"

Then confirmation modal is shown

Message: "This will permanently remove all the pieces you have selected. Any related items with a status of "On order" will also be deleted. Would you like to proceed?

AND user can confirm or cancel

Library enhancement suggested by Lafayette College (May 2022 adopter)

@yuntianhu yuntianhu requested review from SerhiiNosko and a team April 30, 2024 20:08
PieceDeletionHolder holder = new PieceDeletionHolder().withDeleteHolding(false);

List<Future> deleteFutures = ids.stream()
.map(id -> pieceStorageService.getPieceById(id, requestContext)
Copy link
Contributor

Choose a reason for hiding this comment

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

instead of fetching piece one by one, can we get as collections? like getPieces(List pieceIds)..

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I will try it. I see there is a max number of get pieces in batch is 15. I am not sure why. but, I will try it first, and see how it goes.

Copy link
Contributor

Choose a reason for hiding this comment

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

it is some constant to prevent long url query size, the max size of url length - 4 kb, historically we use chunks by 15 elems to avoid this issue.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you for the info, Serhii

src/main/java/org/folio/rest/impl/PiecesAPI.java Outdated Show resolved Hide resolved
Comment on lines 75 to 76


Copy link
Contributor

Choose a reason for hiding this comment

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

please reformat this file one more time

holder.withPieceToDelete(pieceToDelete);
return null;
})
.compose(aHolder -> basePieceFlowHolderBuilder.updateHolderWithOrderInformation(holder, requestContext))
Copy link
Contributor

Choose a reason for hiding this comment

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

The same logic also is in deletePiece method. We should avoid code duplication, logic should be in 1 places

Copy link
Contributor Author

Choose a reason for hiding this comment

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

thank you Serhii, I will rewrite this part

…ion for piecesap.java, modify VeryfyDeleteResponse in RestTestsUtils.java
@yuntianhu yuntianhu requested review from SerhiiNosko, azizbekxm and a team May 7, 2024 14:43
@yuntianhu yuntianhu changed the title Delete received pieces in bulk MODORDERS -1087 Delete received pieces in bulk May 8, 2024
@yuntianhu yuntianhu marked this pull request as ready for review May 8, 2024 13:04
@yuntianhu yuntianhu requested review from SerhiiNosko, azizbekxm and a team and removed request for a team, SerhiiNosko and azizbekxm May 9, 2024 10:55
Copy link

@yuntianhu yuntianhu requested review from a team and removed request for a team May 28, 2024 13:01
yuntianhu added 6 commits May 28, 2024 09:13
# Conflicts:
#	src/main/java/org/folio/service/pieces/flows/delete/PieceDeleteFlowInventoryManager.java
#	src/main/java/org/folio/service/pieces/flows/delete/PieceDeleteFlowManager.java
#	src/test/java/org/folio/service/pieces/flows/delete/PieceDeleteFlowManagerTest.java
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.

3 participants