Search in sources :

Example 6 with CourseRegistration

use of amu.zhcet.data.course.registration.CourseRegistration 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";
}
Also used : FloatedCourseNotFoundException(amu.zhcet.data.course.floated.FloatedCourseNotFoundException) CourseRegistration(amu.zhcet.data.course.registration.CourseRegistration) FloatedCourse(amu.zhcet.data.course.floated.FloatedCourse)

Example 7 with CourseRegistration

use of amu.zhcet.data.course.registration.CourseRegistration 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";
}
Also used : FloatedCourseNotFoundException(amu.zhcet.data.course.floated.FloatedCourseNotFoundException) CourseRegistration(amu.zhcet.data.course.registration.CourseRegistration) FloatedCourse(amu.zhcet.data.course.floated.FloatedCourse)

Example 8 with CourseRegistration

use of amu.zhcet.data.course.registration.CourseRegistration in project zhcet-web by zhcet-amu.

the class CourseRegistrationUploadAdapter method fromRegistrationUpload.

private CourseRegistration fromRegistrationUpload(RegistrationUpload upload) {
    Student student = studentService.getByFacultyNumber(upload.getFacultyNo()).orElseGet(() -> Student.builder().facultyNumber(upload.getFacultyNo()).build());
    CourseRegistration courseRegistration = new CourseRegistration();
    courseRegistration.setMode(upload.getMode());
    courseRegistration.setStudent(student);
    return courseRegistration;
}
Also used : CourseRegistration(amu.zhcet.data.course.registration.CourseRegistration) Student(amu.zhcet.data.user.student.Student)

Aggregations

CourseRegistration (amu.zhcet.data.course.registration.CourseRegistration)8 FloatedCourse (amu.zhcet.data.course.floated.FloatedCourse)4 FloatedCourseNotFoundException (amu.zhcet.data.course.floated.FloatedCourseNotFoundException)3 CourseInCharge (amu.zhcet.data.course.incharge.CourseInCharge)3 CourseInChargeNotFoundException (amu.zhcet.data.course.incharge.CourseInChargeNotFoundException)3 GetMapping (org.springframework.web.bind.annotation.GetMapping)3 Student (amu.zhcet.data.user.student.Student)2 ArrayList (java.util.ArrayList)2 StringUtils (amu.zhcet.common.utils.StringUtils)1 ErrorUtils (amu.zhcet.core.error.ErrorUtils)1 Attendance (amu.zhcet.data.attendance.Attendance)1 Course (amu.zhcet.data.course.Course)1 FloatedCourseService (amu.zhcet.data.course.floated.FloatedCourseService)1 CourseInChargeService (amu.zhcet.data.course.incharge.CourseInChargeService)1 Department (amu.zhcet.data.department.Department)1 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 LocalDateTime (java.time.LocalDateTime)1 DateTimeFormatter (java.time.format.DateTimeFormatter)1 Comparator (java.util.Comparator)1