Search in sources :

Example 1 with FacultyMember

use of amu.zhcet.data.user.faculty.FacultyMember in project zhcet-web by zhcet-amu.

the class FacultyCourseController method facultyCourses.

@GetMapping
public String facultyCourses(Model model) {
    model.addAttribute("page_title", "Course Management");
    model.addAttribute("page_subtitle", "Faculty Floated Course Management");
    model.addAttribute("page_description", "Manage and upload attendance for currently floated courses");
    FacultyMember facultyMember = facultyService.getLoggedInMember().orElseThrow(FacultyMemberNotFoundException::new);
    List<CourseInCharge> courseInCharges = courseInChargeService.getCourseByFaculty(facultyMember);
    // Set the no of registrations for each course
    for (CourseInCharge courseInCharge : courseInCharges) {
        FloatedCourse floatedCourse = courseInCharge.getFloatedCourse();
        floatedCourse.getCourse().setRegistrations(floatedCourse.getCourseRegistrations().size());
    }
    // Sort courses by semester
    courseInCharges.sort(Comparator.comparing(o -> {
        Integer compared = o.getFloatedCourse().getCourse().getSemester();
        return compared != null ? compared : 0;
    }));
    model.addAttribute("courseInCharges", courseInCharges);
    return "faculty/courses";
}
Also used : FacultyService(amu.zhcet.data.user.faculty.FacultyService) CourseInCharge(amu.zhcet.data.course.incharge.CourseInCharge) FacultyMemberNotFoundException(amu.zhcet.data.user.faculty.FacultyMemberNotFoundException) Autowired(org.springframework.beans.factory.annotation.Autowired) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) Controller(org.springframework.stereotype.Controller) CourseInChargeService(amu.zhcet.data.course.incharge.CourseInChargeService) FacultyMember(amu.zhcet.data.user.faculty.FacultyMember) Slf4j(lombok.extern.slf4j.Slf4j) Model(org.springframework.ui.Model) List(java.util.List) FloatedCourse(amu.zhcet.data.course.floated.FloatedCourse) GetMapping(org.springframework.web.bind.annotation.GetMapping) Comparator(java.util.Comparator) CourseInCharge(amu.zhcet.data.course.incharge.CourseInCharge) FloatedCourse(amu.zhcet.data.course.floated.FloatedCourse) FacultyMemberNotFoundException(amu.zhcet.data.user.faculty.FacultyMemberNotFoundException) FacultyMember(amu.zhcet.data.user.faculty.FacultyMember) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 2 with FacultyMember

use of amu.zhcet.data.user.faculty.FacultyMember in project zhcet-web by zhcet-amu.

the class FacultyRegistrationAdapter method fromFacultyUpload.

private static FacultyMember fromFacultyUpload(FacultyUpload facultyUpload) {
    String password = SecurityUtils.generatePassword(PASS_LENGTH);
    facultyUpload.setPassword(password);
    FacultyMember facultyMember = new FacultyMember();
    facultyMember.setFacultyId(StringUtils.capitalizeAll(facultyUpload.getFacultyId()));
    facultyMember.setDesignation(StringUtils.capitalizeFirst(facultyUpload.getDesignation()));
    facultyMember.getUser().setName(StringUtils.capitalizeFirst(facultyUpload.getName()));
    facultyMember.getUser().setPassword(password);
    facultyMember.getUser().setDepartment(Department.builder().name(StringUtils.capitalizeFirst(facultyUpload.getDepartment())).build());
    facultyMember.getUser().getDetails().setGender(facultyUpload.getGender());
    return facultyMember;
}
Also used : FacultyMember(amu.zhcet.data.user.faculty.FacultyMember)

Aggregations

FacultyMember (amu.zhcet.data.user.faculty.FacultyMember)2 FloatedCourse (amu.zhcet.data.course.floated.FloatedCourse)1 CourseInCharge (amu.zhcet.data.course.incharge.CourseInCharge)1 CourseInChargeService (amu.zhcet.data.course.incharge.CourseInChargeService)1 FacultyMemberNotFoundException (amu.zhcet.data.user.faculty.FacultyMemberNotFoundException)1 FacultyService (amu.zhcet.data.user.faculty.FacultyService)1 Comparator (java.util.Comparator)1 List (java.util.List)1 Slf4j (lombok.extern.slf4j.Slf4j)1 Autowired (org.springframework.beans.factory.annotation.Autowired)1 Controller (org.springframework.stereotype.Controller)1 Model (org.springframework.ui.Model)1 GetMapping (org.springframework.web.bind.annotation.GetMapping)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1