Skip to content
Snippets Groups Projects

Converting frontend to use ChihuahUI

All threads resolved!

Files

@@ -19,7 +19,6 @@ package nl.tudelft.tam.controller;
import java.io.IOException;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.util.*;
import java.util.stream.Collectors;
@@ -171,16 +170,14 @@ public class JobOfferController {
/**
* Gets all editions a coordinator is a manager of.
*
* @param person The authenticated person
* @param hidePrev Whether the previous editions should be hidden
* @param q The search query
* @param model The model to add details to
* @return The manager page with managed editions
* @param person The authenticated person
* @param q The search query
* @param model The model to add details to
* @return The manager page with managed editions
*/
@GetMapping("manage")
@PreAuthorize("@authorisationService.isManagerOfAny()")
public String getManagerPortal(@AuthenticatedPerson Person person,
@RequestParam(required = false) Boolean hidePrev,
@RequestParam(required = false) String q,
Model model) {
@@ -196,19 +193,13 @@ public class JobOfferController {
// Filter by the search query
List<EditionDetailsOffersWorkDTO> editions = editionService
.filter(editionService.getEditionsWithJobsAndWork(managedEditionIds), q);
.filter(editionService.getEditionsWithJobsAndWork(managedEditionIds), q)
.stream().sorted(Comparator.comparing(EditionDetailsOffersWorkDTO::getStartDate).reversed())
.toList();
// Add the coordinator defaults to the edition objects
coordinatorDefaultService.addDefaultsToEditionsWithJobsAndWork(editions);
if (hidePrev == null || hidePrev) {
editions = editions.stream().filter(x -> !x.getEndDate()
.isBefore(LocalDateTime.now())).collect(Collectors.toList());
model.addAttribute("hidePrev", true);
} else {
model.addAttribute("hidePrev", false);
}
model.addAttribute("editions", editions);
model.addAttribute("showAll", false);
model.addAttribute("managed", managedCourses);
@@ -220,16 +211,14 @@ public class JobOfferController {
/**
* Gets all editions a coordinator can manage.
*
* @param person The authenticated person
* @param hidePrev Whether the previous editions should be hidden
* @param q The search query
* @param model The model to add details to
* @return The manager page with all editions
* @param person The authenticated person
* @param q The search query
* @param model The model to add details to
* @return The manager page with all editions
*/
@GetMapping("manage/all")
@PreAuthorize("@authorisationService.isCoordinatorOfAny()")
public String getManageAllCourses(@AuthenticatedPerson Person person,
@RequestParam(required = false) Boolean hidePrev,
@RequestParam(required = false) String q,
Model model) {
@@ -250,7 +239,9 @@ public class JobOfferController {
.getCohortsByProgrammeIds(coordinatingProgramIds.stream().toList());
List<EditionDetailsOffersWorkDTO> editions = editionService
.getEditionsWithJobsAndWork(coordinatingEditions);
.getEditionsWithJobsAndWork(coordinatingEditions)
.stream().sorted(Comparator.comparing(EditionDetailsOffersWorkDTO::getStartDate).reversed())
.toList();
// Filter by the search query
editions = editionService.filter(editions, q);
@@ -258,14 +249,6 @@ public class JobOfferController {
// Add the coordinator defaults to the edition objects
coordinatorDefaultService.addDefaultsToEditionsWithJobsAndWork(editions);
if (hidePrev == null || hidePrev) {
editions = editions.stream().filter(x -> !x.getEndDate()
.isBefore(LocalDateTime.now())).collect(Collectors.toList());
model.addAttribute("hidePrev", true);
} else {
model.addAttribute("hidePrev", false);
}
model.addAttribute("editions", editions);
model.addAttribute("showAll", true);
model.addAttribute("managed", coordinatingCourses);
Loading