Search in sources :

Example 1 with UserRole

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);
            }
        }
    }
}
Also used : InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes) Const(teammates.common.util.Const) Date(java.util.Date) FeedbackSessionResultsBundle(teammates.common.datatransfer.FeedbackSessionResultsBundle) CourseRoster(teammates.common.datatransfer.CourseRoster) FeedbackSessionType(teammates.common.datatransfer.FeedbackSessionType) SanitizationHelper(teammates.common.util.SanitizationHelper) HashMap(java.util.HashMap) FeedbackSessionQuestionsBundle(teammates.common.datatransfer.FeedbackSessionQuestionsBundle) StudentAttributes(teammates.common.datatransfer.attributes.StudentAttributes) EntityDoesNotExistException(teammates.common.exception.EntityDoesNotExistException) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet) FeedbackParticipantType(teammates.common.datatransfer.FeedbackParticipantType) UserRole(teammates.common.datatransfer.UserRole) ExceedingRangeException(teammates.common.exception.ExceedingRangeException) Map(java.util.Map) TeammatesException(teammates.common.exception.TeammatesException) FeedbackResponseAttributes(teammates.common.datatransfer.attributes.FeedbackResponseAttributes) Logger(teammates.common.util.Logger) InvalidParametersException(teammates.common.exception.InvalidParametersException) FeedbackQuestionAttributes(teammates.common.datatransfer.attributes.FeedbackQuestionAttributes) TimeHelper(teammates.common.util.TimeHelper) FeedbackSessionDetailsBundle(teammates.common.datatransfer.FeedbackSessionDetailsBundle) FeedbackQuestionDetails(teammates.common.datatransfer.questions.FeedbackQuestionDetails) Set(java.util.Set) FeedbackSessionResponseStatus(teammates.common.datatransfer.FeedbackSessionResponseStatus) StringHelper(teammates.common.util.StringHelper) Instant(java.time.Instant) FeedbackSessionsDb(teammates.storage.api.FeedbackSessionsDb) EntityAlreadyExistsException(teammates.common.exception.EntityAlreadyExistsException) SystemParams(teammates.common.util.Const.SystemParams) List(java.util.List) FeedbackSessionAttributes(teammates.common.datatransfer.attributes.FeedbackSessionAttributes) FeedbackResponseCommentAttributes(teammates.common.datatransfer.attributes.FeedbackResponseCommentAttributes) Assumption(teammates.common.util.Assumption) Entry(java.util.Map.Entry) Comparator(java.util.Comparator) StudentAttributes(teammates.common.datatransfer.attributes.StudentAttributes) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes) HashSet(java.util.HashSet)

Aggregations

Instant (java.time.Instant)1 ArrayList (java.util.ArrayList)1 Comparator (java.util.Comparator)1 Date (java.util.Date)1 HashMap (java.util.HashMap)1 HashSet (java.util.HashSet)1 List (java.util.List)1 Map (java.util.Map)1 Entry (java.util.Map.Entry)1 Set (java.util.Set)1 CourseRoster (teammates.common.datatransfer.CourseRoster)1 FeedbackParticipantType (teammates.common.datatransfer.FeedbackParticipantType)1 FeedbackSessionDetailsBundle (teammates.common.datatransfer.FeedbackSessionDetailsBundle)1 FeedbackSessionQuestionsBundle (teammates.common.datatransfer.FeedbackSessionQuestionsBundle)1 FeedbackSessionResponseStatus (teammates.common.datatransfer.FeedbackSessionResponseStatus)1 FeedbackSessionResultsBundle (teammates.common.datatransfer.FeedbackSessionResultsBundle)1 FeedbackSessionType (teammates.common.datatransfer.FeedbackSessionType)1 UserRole (teammates.common.datatransfer.UserRole)1 FeedbackQuestionAttributes (teammates.common.datatransfer.attributes.FeedbackQuestionAttributes)1 FeedbackResponseAttributes (teammates.common.datatransfer.attributes.FeedbackResponseAttributes)1