En-desarrollo #71

Merged
alex merged 10 commits from En-desarrollo into main 2024-11-15 00:24:15 +00:00
2 changed files with 8 additions and 7 deletions
Showing only changes of commit b1e95cf8a5 - Show all commits

View File

@ -240,7 +240,7 @@ public class RequestEmployeeView extends Div implements HasUrlParameter<String>
.sum();
}
private int getStartDateYear(TimeOffRequest request) {
private int getStartDateYear(final TimeOffRequest request) {
if (request.getStartDate() != null) {
return request.getStartDate().getYear();
}
@ -349,19 +349,19 @@ public class RequestEmployeeView extends Div implements HasUrlParameter<String>
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)
&& !(isMale && getMaleSpecificExclusions().contains(type))
&& type != TimeOffRequestType.TODOS;
}
private TimeOffRequest createRequest(TimeOffRequestType type) {
private TimeOffRequest createRequest(final TimeOffRequestType type) {
TimeOffRequest request = new TimeOffRequest();
request.setCategory(type);
return request;
}
private boolean isVacationExpired(TimeOffRequest request) {
private boolean isVacationExpired(final TimeOffRequest request) {
Vacation vacation = vacationService.findVacationByCategory(request.getCategory());
if (vacation != null && vacation.getMonthOfYear() != null && vacation.getDayOfMonth() != null) {
@ -376,7 +376,7 @@ public class RequestEmployeeView extends Div implements HasUrlParameter<String>
return false;
}
private boolean shouldIncludeRequest(TimeOffRequestType type) {
private boolean shouldIncludeRequest(final TimeOffRequestType type) {
List<TimeOffRequest> existingRequest = requestService.findByEmployeeAndCategory(employeeId, type);
return existingRequest.isEmpty();
}

View File

@ -196,8 +196,9 @@ public class RequestsListView extends Main {
return employeeRequests.stream()
.filter(Objects::nonNull)
.filter(request -> request.getStartDate() != null && (
request.getStartDate().getYear() == currentYear ||
(request.getCategory().name().startsWith("VACACION") && request.getStartDate().getYear() == currentYear - 1)
request.getStartDate().getYear() == currentYear
|| (request.getCategory().name().startsWith("VACACION")
&& request.getStartDate().getYear() == currentYear - 1)
))
.mapToDouble(request -> request.getDaysToBeTake() != null ? request.getDaysToBeTake() : 0.0)
.sum();