use of amu.zhcet.data.course.floated.FloatedCourse in project zhcet-web by zhcet-amu.
the class CourseRegistrationUploadService method registerStudents.
@Transactional
public List<CourseRegistration> registerStudents(Course course, Confirmation<CourseRegistration> confirmation) {
Optional<FloatedCourse> floatedCourseOptional = floatedCourseService.getFloatedCourse(course);
if (!floatedCourseOptional.isPresent())
return Collections.emptyList();
FloatedCourse floatedCourse = floatedCourseOptional.get();
List<CourseRegistration> registrations = new ArrayList<>();
for (CourseRegistration registration : confirmation.getData()) {
registration.setFloatedCourse(floatedCourse);
registration.getAttendance().setId(registration.generateId());
registrations.add(registration);
}
floatedCourse.getCourseRegistrations().addAll(registrations);
floatedCourseService.save(floatedCourse);
return registrations;
}
use of amu.zhcet.data.course.floated.FloatedCourse in project zhcet-web by zhcet-amu.
the class FloatedCourseEditController method courseDetail.
@GetMapping("/{course}")
public String courseDetail(Model model, @PathVariable Course course, WebRequest webRequest) {
FloatedCourse floatedCourse = floatedCourseService.getFloatedCourse(course).orElseThrow(FloatedCourseNotFoundException::new);
if (!model.containsAttribute("success"))
webRequest.removeAttribute("confirmRegistration", RequestAttributes.SCOPE_SESSION);
model.addAttribute("page_title", course.getCode() + " - " + course.getTitle());
model.addAttribute("page_subtitle", "Course management for " + course.getCode());
model.addAttribute("page_description", "Register Students for the Floated course");
List<CourseRegistration> courseRegistrations = floatedCourse.getCourseRegistrations();
List<String> emails = FloatedCourseService.getEmailsFromCourseRegistrations(courseRegistrations.stream()).collect(Collectors.toList());
SortUtils.sortCourseAttendance(courseRegistrations);
model.addAttribute("courseRegistrations", courseRegistrations);
model.addAttribute("floatedCourse", floatedCourse);
model.addAttribute("email_list", emails);
return "dean/floated_course";
}
use of amu.zhcet.data.course.floated.FloatedCourse in project zhcet-web by zhcet-amu.
the class FloatedCourseController method courseDetail.
@GetMapping
public String courseDetail(Model model, @PathVariable Course course, WebRequest webRequest) {
FloatedCourse floatedCourse = floatedCourseService.getFloatedCourse(course).orElseThrow(FloatedCourseNotFoundException::new);
if (!model.containsAttribute("success"))
webRequest.removeAttribute("confirmRegistration", RequestAttributes.SCOPE_SESSION);
model.addAttribute("page_title", course.getCode() + " - " + course.getTitle());
model.addAttribute("page_subtitle", "Course management for " + course.getCode());
model.addAttribute("page_description", "Register Students and add Faculty In-Charge for the course");
model.addAttribute("page_path", getPath(course));
List<CourseRegistration> courseRegistrations = floatedCourse.getCourseRegistrations();
List<String> emails = FloatedCourseService.getEmailsFromCourseRegistrations(courseRegistrations.stream()).collect(Collectors.toList());
SortUtils.sortCourseAttendance(courseRegistrations);
model.addAttribute("courseRegistrations", courseRegistrations);
model.addAttribute("floatedCourse", floatedCourse);
model.addAttribute("sections", FloatedCourseService.getSections(floatedCourse));
model.addAttribute("email_list", emails);
return "department/floated_course";
}
use of amu.zhcet.data.course.floated.FloatedCourse in project zhcet-web by zhcet-amu.
the class FloatedCourseController method removeStudent.
@PostMapping("/unregister")
public String removeStudent(RedirectAttributes attributes, @PathVariable Course course, @RequestParam Student student) {
ErrorUtils.requireNonNullStudent(student);
FloatedCourse floatedCourse = floatedCourseService.getFloatedCourse(course).orElseThrow(FloatedCourseNotFoundException::new);
courseRegistrationService.removeRegistration(floatedCourse, student);
attributes.addFlashAttribute("flash_messages", Flash.success("Student removed from course"));
return "redirect:/admin/department/floated/{course}";
}
Aggregations