En-desarrollo #71
@ -240,7 +240,7 @@ public class RequestEmployeeView extends Div implements HasUrlParameter<String>
|
|||||||
.sum();
|
.sum();
|
||||||
}
|
}
|
||||||
|
|
||||||
private int getStartDateYear(TimeOffRequest request) {
|
private int getStartDateYear(final TimeOffRequest request) {
|
||||||
if (request.getStartDate() != null) {
|
if (request.getStartDate() != null) {
|
||||||
return request.getStartDate().getYear();
|
return request.getStartDate().getYear();
|
||||||
}
|
}
|
||||||
@ -349,19 +349,19 @@ public class RequestEmployeeView extends Div implements HasUrlParameter<String>
|
|||||||
return employeeService.getEmployee(employeeId).getGender() == Employee.Gender.MALE;
|
return employeeService.getEmployee(employeeId).getGender() == Employee.Gender.MALE;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isValidRequestType(TimeOffRequestType type, boolean isMale) {
|
private boolean isValidRequestType(final TimeOffRequestType type, final boolean isMale) {
|
||||||
return !getStandardExclusions().contains(type)
|
return !getStandardExclusions().contains(type)
|
||||||
&& !(isMale && getMaleSpecificExclusions().contains(type))
|
&& !(isMale && getMaleSpecificExclusions().contains(type))
|
||||||
&& type != TimeOffRequestType.TODOS;
|
&& type != TimeOffRequestType.TODOS;
|
||||||
}
|
}
|
||||||
|
|
||||||
private TimeOffRequest createRequest(TimeOffRequestType type) {
|
private TimeOffRequest createRequest(final TimeOffRequestType type) {
|
||||||
TimeOffRequest request = new TimeOffRequest();
|
TimeOffRequest request = new TimeOffRequest();
|
||||||
request.setCategory(type);
|
request.setCategory(type);
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean isVacationExpired(TimeOffRequest request) {
|
private boolean isVacationExpired(final TimeOffRequest request) {
|
||||||
Vacation vacation = vacationService.findVacationByCategory(request.getCategory());
|
Vacation vacation = vacationService.findVacationByCategory(request.getCategory());
|
||||||
|
|
||||||
if (vacation != null && vacation.getMonthOfYear() != null && vacation.getDayOfMonth() != null) {
|
if (vacation != null && vacation.getMonthOfYear() != null && vacation.getDayOfMonth() != null) {
|
||||||
@ -376,7 +376,7 @@ public class RequestEmployeeView extends Div implements HasUrlParameter<String>
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean shouldIncludeRequest(TimeOffRequestType type) {
|
private boolean shouldIncludeRequest(final TimeOffRequestType type) {
|
||||||
List<TimeOffRequest> existingRequest = requestService.findByEmployeeAndCategory(employeeId, type);
|
List<TimeOffRequest> existingRequest = requestService.findByEmployeeAndCategory(employeeId, type);
|
||||||
return existingRequest.isEmpty();
|
return existingRequest.isEmpty();
|
||||||
}
|
}
|
||||||
|
@ -196,8 +196,9 @@ public class RequestsListView extends Main {
|
|||||||
return employeeRequests.stream()
|
return employeeRequests.stream()
|
||||||
.filter(Objects::nonNull)
|
.filter(Objects::nonNull)
|
||||||
.filter(request -> request.getStartDate() != null && (
|
.filter(request -> request.getStartDate() != null && (
|
||||||
request.getStartDate().getYear() == currentYear ||
|
request.getStartDate().getYear() == currentYear
|
||||||
(request.getCategory().name().startsWith("VACACION") && request.getStartDate().getYear() == currentYear - 1)
|
|| (request.getCategory().name().startsWith("VACACION")
|
||||||
|
&& request.getStartDate().getYear() == currentYear - 1)
|
||||||
))
|
))
|
||||||
.mapToDouble(request -> request.getDaysToBeTake() != null ? request.getDaysToBeTake() : 0.0)
|
.mapToDouble(request -> request.getDaysToBeTake() != null ? request.getDaysToBeTake() : 0.0)
|
||||||
.sum();
|
.sum();
|
||||||
|
Loading…
Reference in New Issue
Block a user