Resolver errores de checkstyle
All checks were successful
PR Builder / Build-PR (pull_request) Successful in 2m36s

This commit is contained in:
jesus.pelaez 2024-11-13 19:58:33 -04:00
parent 8e1f0fdd7d
commit b1e95cf8a5
2 changed files with 8 additions and 7 deletions

View File

@ -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();
} }

View File

@ -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();