Correcciones
All checks were successful
PR Builder / Build-PR (pull_request) Successful in 0s

This commit is contained in:
jesus.pelaez 2024-11-04 00:24:34 -04:00
parent 45bf76c3d8
commit eb6183df19
6 changed files with 17 additions and 12 deletions

View File

@ -18,7 +18,7 @@ public class TimeOffRequestService {
timeOffRequestRepository.save(newTimeOffRequest);
}
public void saveAll(List<TimeOffRequest> requests) {
public void saveAll(final List<TimeOffRequest> requests) {
timeOffRequestRepository.saveAll(requests);
}
@ -35,7 +35,7 @@ public class TimeOffRequestService {
return timeOffRequest.orElse(null);
}
public List<TimeOffRequest> findRequestsByState(TimeOffRequestStatus state) {
public List<TimeOffRequest> findRequestsByState(final TimeOffRequestStatus state) {
return timeOffRequestRepository.findByState(state);
}

View File

@ -19,7 +19,7 @@ public class MainView extends Main {
private final TimeOffRequestService requestService;
public MainView(TimeOffRequestService requestService) {
public MainView(final TimeOffRequestService requestService) {
this.requestService = requestService;
add(new Text("Welcome"));
updateRequestStatuses();

View File

@ -84,7 +84,7 @@ public class PendingRequestsListView extends Main {
return new HorizontalLayout(approveButton, rejectButton, closeButton);
}
private Button createActionButton(String caption, TimeOffRequestStatus status) {
private Button createActionButton(final String caption, final TimeOffRequestStatus status) {
return new Button(caption, event -> {
if (selectedRequestId != null) {
TimeOffRequest request = requestService.findTimeOffRequest(selectedRequestId);
@ -112,7 +112,8 @@ public class PendingRequestsListView extends Main {
final Employee employee,
final Team team,
final TimeOffRequestType category) {
List<TimeOffRequest> filteredPendingRequests = requestService.findRequestsByState(TimeOffRequestStatus.PENDIENTE);
List<TimeOffRequest> filteredPendingRequests
= requestService.findRequestsByState(TimeOffRequestStatus.PENDIENTE);
if (employee != null && !"TODOS".equals(employee.getFirstName())) {
filteredPendingRequests = filteredPendingRequests.stream()
@ -122,7 +123,8 @@ public class PendingRequestsListView extends Main {
if (team != null && !"TODOS".equals(team.getName())) {
filteredPendingRequests = filteredPendingRequests.stream()
.filter(emp -> emp.getEmployee().getTeam() != null && emp.getEmployee().getTeam().getId().equals(team.getId()))
.filter(emp -> emp.getEmployee().getTeam() != null
&& emp.getEmployee().getTeam().getId().equals(team.getId()))
.collect(Collectors.toList());
}
@ -142,7 +144,8 @@ public class PendingRequestsListView extends Main {
}
private String getEmployeeFullNameLabel(final Employee employee) {
return "TODOS".equals(employee.getFirstName()) ? "TODOS" : employee.getFirstName() + " " + employee.getLastName();
return "TODOS".equals(employee.getFirstName())
? "TODOS" : employee.getFirstName() + " " + employee.getLastName();
}
private String getTeamName(final TimeOffRequest request) {
@ -154,7 +157,7 @@ public class PendingRequestsListView extends Main {
return "TODOS".equals(team.getName()) ? "TODOS" : team.getName();
}
private String getCategory(TimeOffRequest request){
private String getCategory(final TimeOffRequest request) {
return String.valueOf(request.getCategory());
}

View File

@ -21,7 +21,6 @@ import com.vaadin.flow.spring.annotation.SpringComponent;
import jakarta.annotation.security.PermitAll;
import org.springframework.context.annotation.Scope;
import java.time.LocalDate;
import java.util.Collections;
import java.util.List;
import java.util.UUID;

View File

@ -136,7 +136,8 @@ public class RequestRegisterView extends VerticalLayout {
List<TimeOffRequestType> availableCategories = allCategories.stream()
.filter(category -> isCategoryAvailable(employeeRequests, category))
.filter(category -> isCategoryAllowedByGender(category, employee.getGender()))
.filter(category -> category != TimeOffRequestType.VACACION_GESTION_ANTERIOR && category != TimeOffRequestType.TODOS)
.filter(category -> category != TimeOffRequestType.VACACION_GESTION_ANTERIOR
&& category != TimeOffRequestType.TODOS)
.toList();
categoryComboBox.setItems(availableCategories);
@ -235,7 +236,8 @@ public class RequestRegisterView extends VerticalLayout {
endDate = null;
UUID employeeId = employee.getId();
List<TimeOffRequest> previousRequests = requestService.findByEmployeeAndCategory(employeeId, vacation.getCategory());
List<TimeOffRequest> previousRequests
= requestService.findByEmployeeAndCategory(employeeId, vacation.getCategory());
int startYear = calculateStartYear(previousRequests);

View File

@ -141,7 +141,8 @@ public class RequestsListView extends Main {
}
private String getEmployeeFullName(final Employee employee) {
return "TODOS".equals(employee.getFirstName()) ? "TODOS" : employee.getFirstName() + " " + employee.getLastName();
return "TODOS".equals(employee.getFirstName())
? "TODOS" : employee.getFirstName() + " " + employee.getLastName();
}
private String getTeamName(final Employee employee) {