-
Notifications
You must be signed in to change notification settings - Fork 25
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 1886 add dropdown for item service point #1335
base: master
Are you sure you want to change the base?
Conversation
src/main/java/org/folio/circulation/domain/RequestRepresentation.java
Outdated
Show resolved
Hide resolved
src/main/java/org/folio/circulation/infrastructure/storage/ServicePointRepository.java
Show resolved
Hide resolved
src/main/java/org/folio/circulation/infrastructure/storage/ServicePointRepository.java
Outdated
Show resolved
Hide resolved
src/main/java/org/folio/circulation/resources/RequestCollectionResource.java
Outdated
Show resolved
Hide resolved
src/test/java/org/folio/circulation/infrastructure/storage/ServicePointRepositoryTest.java
Show resolved
Hide resolved
Kudos, SonarCloud Quality Gate passed! |
@@ -148,6 +148,9 @@ private static JsonObject locationSummary(Location location) { | |||
write(locationSummary, "name", location.getName()); | |||
write(locationSummary, "libraryName", location.getLibraryName()); | |||
write(locationSummary, "code", location.getCode()); | |||
if(location.getPrimaryServicePoint() != null) { |
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.
if(location.getPrimaryServicePoint() != null) { | |
if (location.getPrimaryServicePoint() != null) { |
break; | ||
} | ||
} | ||
if(!foundSP) { |
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.
if(!foundSP) { | |
if (!foundSP) { |
boolean foundSP = false; | ||
|
||
for(ServicePoint servicePoint : spCollection) { | ||
if(request.getItem() != null && request.getItem().getLocation() != null && request.getItem().getLocation().getPrimaryServicePointId() != null && |
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.
if(request.getItem() != null && request.getItem().getLocation() != null && request.getItem().getLocation().getPrimaryServicePointId() != null && | |
if (request.getItem() != null && request.getItem().getLocation() != null && request.getItem().getLocation().getPrimaryServicePointId() != null && |
List<Request> newRequestList = new ArrayList<>(); | ||
Collection<ServicePoint> spCollection = multipleServicePoints.getRecords(); | ||
|
||
for(Request request : requests) { |
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.
for(Request request : requests) { | |
for (Request request : requests) { |
Request newRequest = null; | ||
boolean foundSP = false; | ||
|
||
for(ServicePoint servicePoint : spCollection) { |
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.
for(ServicePoint servicePoint : spCollection) { | |
for (ServicePoint servicePoint : spCollection) { |
import io.vertx.core.json.JsonArray; | ||
import io.vertx.core.json.JsonObject; | ||
import org.apache.commons.lang.StringUtils; | ||
import org.folio.circulation.domain.*; |
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.
don't import all package
import static org.junit.jupiter.api.Assertions.assertEquals; | ||
import static org.junit.jupiter.api.Assertions.assertTrue; | ||
import static org.mockito.ArgumentMatchers.any; | ||
import static org.mockito.Mockito.*; |
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.
the same as above
} | ||
|
||
@Test | ||
void parseQueryWithThreePSPIds() { |
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.
Does it make sense to do the same as previous tests do? Maybe it makes sense to consider including inclusion within a single test?
final List<String> servicePointsToFetch = requests.stream() | ||
.filter(Objects::nonNull) | ||
.map(r -> r.getItem() != null ? r.getItem().getLocation().getPrimaryServicePointId() : null) | ||
.filter(Objects::nonNull) | ||
.map(Object::toString) | ||
.distinct() | ||
.toList(); |
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.
final List<String> servicePointsToFetch = requests.stream() | |
.filter(Objects::nonNull) | |
.map(r -> r.getItem() != null ? r.getItem().getLocation().getPrimaryServicePointId() : null) | |
.filter(Objects::nonNull) | |
.map(Object::toString) | |
.distinct() | |
.toList(); | |
List<String> servicePointsToFetch = requests.stream() | |
.map(Request::getItem) | |
.filter(Objects::nonNull) | |
.map(Item::getLocation) | |
.map(Location::getPrimaryServicePointId) | |
.filter(Objects::nonNull) | |
.map(Object::toString) | |
.distinct() | |
.toList(); |
multipleServicePoints -> { | ||
List<Request> newRequestList = new ArrayList<>(); | ||
Collection<ServicePoint> spCollection = multipleServicePoints.getRecords(); |
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.
consider moving this lambda into separate method
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.
Changes required
Kudos, SonarCloud Quality Gate passed! |
Quality Gate passedIssues Measures |
1 similar comment
Quality Gate passedIssues Measures |
Quality Gate passedIssues Measures |
Purpose
https://issues.folio.org/browse/CIRC-1886
To populate the drop down the (ServicePoint) code will need to be used, this allows the already existing service point code to be leveraged.
User must have the view request permission. Users: View requests, this should also limit them to their assigned service point/s. (This may need to be updated to suit general open source) This does match the generic permission in snapshot.
Approach
The request list is filtered in the backend based on the item selected in Primary Service Point name dropdown.
TODOS and Open Questions
Learning