Skip to content
Snippets Groups Projects

Filter non-active courses from All Declarations/Applications

6 files
+ 105
29
Compare changes
  • Side-by-side
  • Inline

Files

@@ -18,13 +18,11 @@
package nl.tudelft.tam.controller;
import java.io.IOException;
import java.util.stream.Collectors;
import nl.tudelft.labracore.lib.security.user.AuthenticatedPerson;
import nl.tudelft.labracore.lib.security.user.Person;
import nl.tudelft.tam.service.ApplicationService;
import nl.tudelft.tam.service.CSVService;
import nl.tudelft.tam.service.DeclarationService;
import nl.tudelft.tam.service.PersonService;
import nl.tudelft.tam.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.core.io.Resource;
@@ -43,14 +41,11 @@ public class ApplicationController {
@Autowired
ApplicationService applicationService;
@Autowired
DeclarationService declarationService;
@Autowired
CSVService csvService;
@Autowired
PersonService personService;
EditionService editionService;
// endregion
@@ -66,7 +61,10 @@ public class ApplicationController {
@GetMapping("all")
@PreAuthorize("@authorisationService.isCoordinatorOfAny()")
public String getAllApplications(@AuthenticatedPerson Person person, Model model) {
model.addAttribute("applications", applicationService.getCoordinatingApplications(person.getId()));
model.addAttribute("applications", applicationService.getCoordinatingApplications(person.getId())
.stream()
.filter(x -> !editionService.getOrThrow(x.getJobOffer().getEditionId()).getIsArchived())
.collect(Collectors.toList()));
return "application/all";
}
@@ -187,7 +185,10 @@ public class ApplicationController {
public ResponseEntity<Resource> exportApplications(@AuthenticatedPerson Person person)
throws IOException {
return csvService.getResponse(applicationService.exportApplications("applications",
applicationService.getCoordinatingApplications(person.getId())));
applicationService.getCoordinatingApplications(person.getId()).stream()
.filter(x -> !editionService.getOrThrow(x.getJobOffer().getEditionId())
.getIsArchived())
.collect(Collectors.toList())));
}
}
Loading