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

CIRC-1785 Add "service point for the effective location" and "Request Date"as staff slip token #1280

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

Conversation

rgupta-nla
Copy link
Contributor

https://issues.folio.org/browse/UXPROD-4179
Add "service point for the effective location" as staff slip token
https://issues.folio.org/browse/UXPROD-4180
Add "Request date" as staff slip token

Purpose

Purpose of this PR is to add "service point for the effective location" as staff slip token and add "Request date" as staff slip token. The changes would reflect in staff slip produced in the Requests app (pick slip) and staff slip produced in the Check in app (hold, delivery request and transfer slips).

Approach

We are getting ServicePoint object information by fetching it passing the servicePoingId. We then grab the service point location (primary location ) and stick it to the item context. This is done for pick slip resource.

For the checkin app, the location name is already available in the Item object so we just add it to json object.

TODOS and Open Questions

  • Check logging

Learning

image
image

@sonarqubecloud
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 1 Code Smell

89.5% 89.5% Coverage
0.0% 0.0% Duplication

@rgupta-nla rgupta-nla changed the title UXPROD-4179 and UXPROD-4180 Add "service point for the effective location" and "Request Date"as staff slip token CIRC-1785 Add "service point for the effective location" and "Request Date"as staff slip token May 3, 2023
if (entries == null) {
return new JsonObject();
}
if(primaryServicePoint == null) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Space is missing (different style from line 113)

@@ -108,6 +109,19 @@ public static JsonObject createStaffSlipContext(Request request) {
return createStaffSlipContext(request.getItem(), request);
}

public static JsonObject addPrimaryServicePointNameToStaffSlipContext(JsonObject entries, ServicePoint primaryServicePoint) {
Copy link
Contributor

Choose a reason for hiding this comment

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

We now have to follow this doc https://wiki.folio.org/display/DD/Logging when creating new code. mod-circulation is still not fully covered with the new-style logging yet, but the new code already needs to meet this criteria. I think it would be nice to at least cover addPrimaryServicePointNameToStaffSlipContext method

@@ -104,6 +104,8 @@ private void getMany(RoutingContext routingContext) {
.thenComposeAsync(r -> r.after(addressTypeRepository::findAddressTypesForRequests))
.thenComposeAsync(r -> r.after(servicePointRepository::findServicePointsForRequests))
.thenApply(flatMapResult(this::mapResultToJson))
.thenComposeAsync(a -> a.combineAfter(() -> servicePointRepository.getServicePointById(servicePointId),
Copy link
Contributor

Choose a reason for hiding this comment

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

If a is a Result, we typically shorten it to r (lines 98-105)

Comment on lines +249 to +251
optionalRequest
.map(Request::getRequestDate)
.ifPresent(value -> write(requestContext, "requestDate", value));
Copy link
Contributor

Choose a reason for hiding this comment

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

I believe this should a part of another PR because it's not required in CIRC-1785, but anyway, is it covered with tests?

@@ -184,6 +198,7 @@ private static JsonObject createItemContext(Item item) {
if (location != null) {
itemContext
.put("effectiveLocationSpecific", location.getName())
.put("effectiveLocationPrimaryServicePointName", location.getPrimaryServicePoint().getName())
Copy link
Contributor

Choose a reason for hiding this comment

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

If this changes the API (and is looks like it does - we're adding another field to the /circulation/pick-slips/{id} endpoint) we should increase minor version of the corresponding interface in the ModuleDescriptor. Check the 'Version numbers' section here https://dev.folio.org/guidelines/contributing/ specifically this part: If you only add things to the interface – e.g. a new resource or method on existing resources – then you increment the minor number, because the API is backwards compatible.

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.

2 participants