Skip to content
Snippets Groups Projects

Prevent enqueueing without a group if groups are required

Files

@@ -18,10 +18,8 @@
package nl.tudelft.queue.controller;
import nl.tudelft.labracore.api.AssignmentControllerApi;
import nl.tudelft.labracore.api.dto.AssignmentCreateDTO;
import nl.tudelft.labracore.api.dto.EditionDetailsDTO;
import nl.tudelft.labracore.api.dto.ModuleDetailsDTO;
import nl.tudelft.labracore.api.dto.ModuleSummaryDTO;
import nl.tudelft.labracore.api.StudentGroupControllerApi;
import nl.tudelft.labracore.api.dto.*;
import nl.tudelft.queue.cache.AssignmentCacheManager;
import nl.tudelft.queue.cache.EditionCacheManager;
import nl.tudelft.queue.cache.ModuleCacheManager;
@@ -50,6 +48,9 @@ public class AssignmentController {
@Autowired
private AssignmentControllerApi aApi;
@Autowired
private StudentGroupControllerApi sgApi;
/**
* Gets the page for creating an assignment. This is a basic page with only the most basic of properties
* for an assignment. Further adjustments or creation options should be made available in Portal or later
@@ -141,6 +142,24 @@ public class AssignmentController {
return "redirect:/edition/" + module.getEdition().getId() + "/modules";
}
/**
* Get the page with a list of groups to join for an assignment.
*
* @param assignmentId The id of the assignment
* @return The group page
*/
@GetMapping("/assignment/{assignmentId}/groups")
public String getAssignmentGroups(@PathVariable Long assignmentId, Model model) {
AssignmentDetailsDTO assignment = aCache.getRequired(assignmentId);
ModuleDetailsDTO module = mCache.getRequired(assignment.getModule().getId());
model.addAttribute("module", module);
model.addAttribute("edition", eCache.getRequired(module.getEdition().getId()));
model.addAttribute("groups", sgApi.getAllGroupsInModule(module.getId()).collectList().block());
return "module/groups";
}
/**
* Adds attributes for the create assignment page to the given model.
*
Loading