Skip to content
Snippets Groups Projects

Resolve "Copy assignments to new edition"

Compare and
17 files
+ 499
11
Compare changes
  • Side-by-side
  • Inline

Files

@@ -238,6 +238,27 @@ public class EditionController {
return "edition/assist";
}
/**
* Copies existing modules to an edition.
*
* @param ids The moduleIds
* @param editionId The edition id
* @return The page to redirect to
*/
@PostMapping("/{editionId}/import-modules")
@PreAuthorize("@authorizationService.canCreateModule(#editionId)")
public String importModules(@RequestParam String ids, @PathVariable Long editionId,
RedirectAttributes redirectAttributes) {
try {
moduleService.copyModulesToEdition(
Arrays.stream(ids.split(",")).filter(x -> !x.isBlank()).map(Long::valueOf).toList(),
editionId);
} catch (Exception e) {
redirectAttributes.addFlashAttribute("import_error", e.getMessage());
}
return "redirect:/edition/" + editionId;
}
/**
* Gets the student page for an edition. This is the only edition page students typically see.
*
Loading