diff --git a/src/main/java/com/primefactorsolutions/views/RequestEmployeeView.java b/src/main/java/com/primefactorsolutions/views/RequestEmployeeView.java index 6737dc5..58b4ab6 100644 --- a/src/main/java/com/primefactorsolutions/views/RequestEmployeeView.java +++ b/src/main/java/com/primefactorsolutions/views/RequestEmployeeView.java @@ -244,22 +244,21 @@ public class RequestEmployeeView extends Div implements HasUrlParameter private double calculateHolidayUtilizedDays(final int year) { return requests.stream() .filter(this::verificationIsHoliday) + .filter(this::verificationIsHoliday) + .filter(req -> req.getState() == TimeOffRequestStatus.APROBADO) + .filter(req -> req.getState() == TimeOffRequestStatus.EN_USO) + .filter(req -> req.getState() == TimeOffRequestStatus.TOMADO) .filter(req -> getStartDateYear(req) == year) .mapToDouble(TimeOffRequest::getDaysToBeTake) .sum(); } - private double calculateVacationUtilizedDays(final int year) { - return requests.stream() - .filter(req -> req.getCategory().name().startsWith("VACACION")) - .filter(req -> getStartDateYear(req) == year || getStartDateYear(req) == year - 1) - .mapToDouble(TimeOffRequest::getDaysBalance) - .sum(); - } - private double calculatePersonalDaysUtilized(final boolean isMale, final int year) { return requests.stream() .filter(req -> !verificationIsHoliday(req)) + .filter(req -> req.getState() == TimeOffRequestStatus.APROBADO) + .filter(req -> req.getState() == TimeOffRequestStatus.EN_USO) + .filter(req -> req.getState() == TimeOffRequestStatus.TOMADO) .filter(req -> !getStandardExclusions().contains(req.getCategory())) .filter(req -> !(isMale && getMaleSpecificExclusions().contains(req.getCategory()))) .filter(req -> !req.getCategory().name().startsWith("VACACION"))