Skip to content

Commit

Permalink
Merge pull request #647 from Shilpa-Manjunath/locationbug
Browse files Browse the repository at this point in the history
reverted back changes made for update in location
  • Loading branch information
nayakrounak authored Feb 11, 2022
2 parents c2a90b6 + baf593f commit 25e93e4
Show file tree
Hide file tree
Showing 3 changed files with 1 addition and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -145,10 +145,6 @@ List<Location> findLocationByHierarchyLevelStartsWith(Short hierarchyLevel, Stri
@Query("FROM Location l WHERE l.name=?1 AND l.hierarchyLevel=?2 AND l.langCode=?3 AND NOT code=?4")
List<Location> findByNameAndLevelLangCodeNotCode(String name,Short hierarchyLevel, String langCode, String code);


@Query("FROM Location l WHERE l.name=?1 AND l.parentLocCode=?2 AND l.hierarchyLevel=?3 AND l.langCode=?4 AND l.isActive=true AND NOT code=?5" )
List<Location> findByNameParentLoccodeAndLevelLangCodeNotCode(String name, String parentCode,Short hierarchyLevel, String langCode, String code);

/**
* give list of the immediate Locations for the given parent location code
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,7 @@ public LocationPutResponseDto updateLocationDetails(LocationDto locationDto) {
throw new RequestException(LocationErrorCode.INVALID_HIERARCY_LEVEL.getErrorCode(),
LocationErrorCode.INVALID_HIERARCY_LEVEL.getErrorMessage());
}
List<Location> list = (null!=locationDto.getParentLocCode() && !locationDto.getParentLocCode().isEmpty())? locationRepository.findByNameParentLoccodeAndLevelLangCodeNotCode(locationDto.getName(),
locationDto.getParentLocCode(), locationDto.getHierarchyLevel(), locationDto.getLangCode(), locationDto.getCode()): locationRepository.findByNameAndLevelLangCodeNotCode(locationDto.getName(),
List<Location> list = locationRepository.findByNameAndLevelLangCodeNotCode(locationDto.getName(),
locationDto.getHierarchyLevel(), locationDto.getLangCode(), locationDto.getCode());
if (list != null && !list.isEmpty()) {
auditUtil.auditRequest(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -243,8 +243,6 @@ public void updateLocationAlreadyExistsUnderHeirarchyExceptionTest() throws Exce
dto1.setIsActive(true);
request.setRequest(dto1);
String requestJson = mapper.writeValueAsString(request);
when(repo.findByNameParentLoccodeAndLevelLangCodeNotCode(Mockito.any(),Mockito.any(),Mockito.any(),Mockito.any(), Mockito.any()))
.thenReturn(Arrays.asList(location1));
when(repo.findLocationHierarchyByCodeAndLanguageCode(Mockito.any(), Mockito.any()))
.thenReturn(Arrays.asList(location1));
when(repo.findByNameAndLevelLangCodeNotCode(Mockito.any(),Mockito.any(),Mockito.any(), Mockito.any())).thenReturn(Arrays.asList(location1));
Expand Down

0 comments on commit 25e93e4

Please sign in to comment.