use of teammates.common.datatransfer.UserRole in project teammates by TEAMMATES.
the class FeedbackSessionsLogic method addSectionTeamNamesToTable.
private void addSectionTeamNamesToTable(Map<String, Set<String>> sectionTeamNameTable, CourseRoster roster, String courseId, String userEmail, UserRole role, String feedbackSessionName, String sectionToView) {
InstructorAttributes instructor = getInstructor(courseId, userEmail, role);
if (instructor != null) {
for (StudentAttributes student : roster.getStudents()) {
boolean isVisibleResponse = instructor.isAllowedForPrivilege(student.section, feedbackSessionName, Const.ParamsNames.INSTRUCTOR_PERMISSION_VIEW_SESSION_IN_SECTIONS);
boolean isStudentInSelectedSection = student.section.equals(sectionToView);
boolean isViewingAllSections = sectionToView == null;
if (isVisibleResponse && (isViewingAllSections || isStudentInSelectedSection)) {
String section = student.section;
sectionTeamNameTable.computeIfAbsent(section, key -> new HashSet<>()).add(student.team);
}
}
}
}
Aggregations