Search in sources :

Example 1 with Student

use of amu.zhcet.data.user.student.Student in project zhcet-web by zhcet-amu.

the class StudentRegistrationAdapter method fromStudentUpload.

private static Student fromStudentUpload(StudentUpload studentUpload) {
    Student student = new Student();
    student.setEnrolmentNumber(studentUpload.getEnrolmentNumber());
    student.setFacultyNumber(studentUpload.getFacultyNumber());
    student.getUser().setName(studentUpload.getName());
    Department department = Department.builder().name(StringUtils.capitalizeFirst(studentUpload.getDepartment())).build();
    student.getUser().setDepartment(department);
    student.setSection(studentUpload.getSection());
    student.setHallCode(studentUpload.getHall());
    student.setRegistrationYear(studentUpload.getRegistrationYear());
    student.setStatus(studentUpload.getStatus());
    student.getUser().getDetails().setGender(studentUpload.getGender());
    return student;
}
Also used : Department(amu.zhcet.data.department.Department) Student(amu.zhcet.data.user.student.Student)

Example 2 with Student

use of amu.zhcet.data.user.student.Student in project zhcet-web by zhcet-amu.

the class StudentAttendanceController method attendance.

@GetMapping
public String attendance(Model model) {
    Student student = studentService.getLoggedInStudent().orElseThrow(StudentNotFoundException::new);
    model.addAttribute("page_title", "Attendance");
    model.addAttribute("page_subtitle", "Attendance Panel for " + student.getEnrolmentNumber() + " | " + student.getUser().getName());
    model.addAttribute("page_description", "View attendance of floated courses this session");
    model.addAttribute("attendances", attendanceService.getAttendanceByStudent(student));
    return "student/attendance";
}
Also used : StudentNotFoundException(amu.zhcet.data.user.student.StudentNotFoundException) Student(amu.zhcet.data.user.student.Student) GetMapping(org.springframework.web.bind.annotation.GetMapping)

Example 3 with Student

use of amu.zhcet.data.user.student.Student in project zhcet-web by zhcet-amu.

the class SortUtilsTest method testSortCourseRegistrations.

@Test
public void testSortCourseRegistrations() {
    CourseRegistration areebRegistration = new CourseRegistration();
    CourseRegistration divyRegistration = new CourseRegistration();
    CourseRegistration saimRegistration = new CourseRegistration();
    Student areeb = new Student();
    Student divy = new Student();
    Student saim = new Student();
    areebRegistration.setStudent(areeb);
    divyRegistration.setStudent(divy);
    saimRegistration.setStudent(saim);
    areeb.setFacultyNumber(AREEB_FACULTY_NO);
    areeb.setSection(SECTION_A4PE);
    divy.setFacultyNumber(DIVY_FACULTY_NO);
    divy.setSection(SECTION_A4PE);
    saim.setFacultyNumber(SAIM_FACULTY_NO);
    saim.setSection(SECTION_A5PE);
    List<CourseRegistration> courseRegistrations = new ArrayList<>();
    courseRegistrations.addAll(Arrays.asList(divyRegistration, saimRegistration, areebRegistration));
    SortUtils.sortCourseAttendance(courseRegistrations);
    assertThat(courseRegistrations, contains(areebRegistration, divyRegistration, saimRegistration));
}
Also used : CourseRegistration(amu.zhcet.data.course.registration.CourseRegistration) ArrayList(java.util.ArrayList) Student(amu.zhcet.data.user.student.Student) Test(org.junit.Test)

Example 4 with Student

use of amu.zhcet.data.user.student.Student 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

Student (amu.zhcet.data.user.student.Student)4 CourseRegistration (amu.zhcet.data.course.registration.CourseRegistration)2 Department (amu.zhcet.data.department.Department)1 StudentNotFoundException (amu.zhcet.data.user.student.StudentNotFoundException)1 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1 GetMapping (org.springframework.web.bind.annotation.GetMapping)1