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";
}
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;
}
Aggregations