Commit 3e0f1967 authored by vikram singh's avatar vikram singh

updated isReleased method for future allocation

parent 5949358b
...@@ -428,20 +428,17 @@ public class ResourceService implements IResourceService { ...@@ -428,20 +428,17 @@ public class ResourceService implements IResourceService {
public boolean isReleased(Resource resourceReq){ public boolean isReleased(Resource resourceReq){
String message = ""; String message = "";
boolean released = false; boolean released = true;
List<Resource> resourceList = resourceRepo.findByEmployeeId(resourceReq.getEmployeeId()); List<Resource> resourceList = resourceRepo.findByEmployeeId(resourceReq.getEmployeeId());
Resource currentAllocation = getCurrentAllocationIfNotReturnNull(resourceReq.getEmployeeId()); Resource currentAllocation = getCurrentAllocationIfNotReturnNull(resourceReq.getEmployeeId());
if(currentAllocation == null){ if(currentAllocation == null){
Resource latestAllocation = getLatestAllocation(resourceList.stream().filter(r -> r.getBillingEndDate().compareTo(resourceReq.getBillingStartDate()) < 0).collect(Collectors.toList())); Resource latestAllocation = getLatestAllocation(resourceList.stream().filter(r -> r.getBillingEndDate().compareTo(resourceReq.getBillingStartDate()) < 0).collect(Collectors.toList()));
if(latestAllocation != null && latestAllocation.getStatus().equals(MyTeamUtils.STATUS_ENGAGED)){ if(!resourceReq.getStatus().equals(MyTeamUtils.STATUS_PROPOSED) && latestAllocation != null && latestAllocation.getStatus().equals(MyTeamUtils.STATUS_ENGAGED)){
//not released //not released
released=false;
message = "Resource is not released from "+projectService.getProjectByProjectId(latestAllocation.getProjectId()).getProjectName(); message = "Resource is not released from "+projectService.getProjectByProjectId(latestAllocation.getProjectId()).getProjectName();
respMap.put("statusCode", 810); respMap.put("statusCode", 810);
}else{
released = true;
} }
}else{
released = true;
} }
respMap.put("message", message); respMap.put("message", message);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment