Skip to content
Snippets Groups Projects

Allow teachers to upload csv with must review students

Files

@@ -38,6 +38,8 @@ import nl.tudelft.labracore.lib.security.user.AuthenticatedPerson;
import nl.tudelft.labracore.lib.security.user.Person;
import nl.tudelft.librador.resolver.annotations.PathEntity;
import nl.tudelft.queue.cache.*;
import nl.tudelft.queue.csv.EmptyCsvException;
import nl.tudelft.queue.csv.InvalidCsvException;
import nl.tudelft.queue.dto.create.labs.CapacitySessionCreateDTO;
import nl.tudelft.queue.dto.create.labs.ExamLabCreateDTO;
import nl.tudelft.queue.dto.create.labs.RegularLabCreateDTO;
@@ -72,6 +74,7 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;
import com.google.common.net.HttpHeaders;
@@ -661,6 +664,23 @@ public class LabController {
.body(resource);
}
/**
* Imports a list of students which should get priority for reviewing during an exam lab.
*
* @param session The exam lab to which they should be added.
* @param csv The csv file containing NetIDs for these students.
* @return
* @throws EmptyCsvException
* @throws InvalidCsvException
*/
@PostMapping("/lab/{session}/import")
@PreAuthorize("@permissionService.canManageSession(#session)")
public String importStudents(@PathEntity ExamLab session,
@RequestParam("file") MultipartFile csv) throws EmptyCsvException, InvalidCsvException {
ls.addStudentsToReview(session, csv);
return "redirect:/lab/" + session.getId();
}
/**
* Sets the model attributes for an enqueueing or editing requests page.
*
Loading