Search in sources :

Example 16 with TeamDetailsBundle

use of teammates.common.datatransfer.TeamDetailsBundle in project teammates by TEAMMATES.

the class InstructorCourseDetailsPageData method init.

public void init(InstructorAttributes currentInstructor, CourseDetailsBundle courseDetails, List<InstructorAttributes> instructors) {
    this.currentInstructor = currentInstructor;
    this.courseDetails = courseDetails;
    this.instructors = instructors;
    boolean isDisabled = !currentInstructor.isAllowedForPrivilege(Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_STUDENT);
    String courseId = sanitizeForJs(courseDetails.course.getId());
    String href = sanitizeForJs(getInstructorCourseRemindLink(courseDetails.course.getId()));
    courseRemindButton = createButton(null, "btn btn-primary", "button_remind", href, Const.Tooltips.COURSE_REMIND, "tooltip", courseId, isDisabled);
    String hrefDeleteStudents = sanitizeForJs(getInstructorCourseStudentDeleteAllLink(courseId));
    courseDeleteAllButton = createButton(null, "btn btn-danger course-student-delete-all-link", "button-delete-all", hrefDeleteStudents, null, null, courseId, isDisabled);
    this.sections = new ArrayList<>();
    for (SectionDetailsBundle section : courseDetails.sections) {
        Map<String, String> emailPhotoUrlMapping = new HashMap<>();
        for (TeamDetailsBundle teamDetails : section.teams) {
            for (StudentAttributes student : teamDetails.students) {
                String studentPhotoUrl = student.getPublicProfilePictureUrl();
                studentPhotoUrl = Url.addParamToUrl(studentPhotoUrl, Const.ParamsNames.USER_ID, account.googleId);
                emailPhotoUrlMapping.put(student.email, studentPhotoUrl);
            }
        }
        boolean isAllowedToViewStudentInSection = currentInstructor.isAllowedForPrivilege(section.name, Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_STUDENT_IN_SECTIONS);
        boolean isAllowedToModifyStudent = currentInstructor.isAllowedForPrivilege(section.name, Const.ParamsNames.INSTRUCTOR_PERMISSION_MODIFY_STUDENT);
        this.sections.add(new StudentListSectionData(section, isAllowedToViewStudentInSection, isAllowedToModifyStudent, emailPhotoUrlMapping, account.googleId, getSessionToken()));
    }
    if (sections.size() == 1) {
        StudentListSectionData section = sections.get(0);
        this.hasSection = !"None".equals(section.getSectionName());
    } else {
        this.hasSection = true;
    }
}
Also used : TeamDetailsBundle(teammates.common.datatransfer.TeamDetailsBundle) HashMap(java.util.HashMap) StudentListSectionData(teammates.ui.template.StudentListSectionData) SectionDetailsBundle(teammates.common.datatransfer.SectionDetailsBundle) StudentAttributes(teammates.common.datatransfer.attributes.StudentAttributes)

Aggregations

TeamDetailsBundle (teammates.common.datatransfer.TeamDetailsBundle)16 StudentAttributes (teammates.common.datatransfer.attributes.StudentAttributes)13 ArrayList (java.util.ArrayList)8 SectionDetailsBundle (teammates.common.datatransfer.SectionDetailsBundle)7 InstructorAttributes (teammates.common.datatransfer.attributes.InstructorAttributes)6 HashMap (java.util.HashMap)5 EntityDoesNotExistException (teammates.common.exception.EntityDoesNotExistException)5 CourseAttributes (teammates.common.datatransfer.attributes.CourseAttributes)3 Map (java.util.Map)2 CourseDetailsBundle (teammates.common.datatransfer.CourseDetailsBundle)2 AccountAttributes (teammates.common.datatransfer.attributes.AccountAttributes)2 InstructorStudentListAjaxPageData (teammates.ui.pagedata.InstructorStudentListAjaxPageData)2 StudentListSectionData (teammates.ui.template.StudentListSectionData)2 ZoneId (java.time.ZoneId)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Set (java.util.Set)1 Test (org.testng.annotations.Test)1 FeedbackParticipantType (teammates.common.datatransfer.FeedbackParticipantType)1 FeedbackResponseCommentSearchResultBundle (teammates.common.datatransfer.FeedbackResponseCommentSearchResultBundle)1