Search in sources :

Example 6 with CourseRoster

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

the class FeedbackSessionsLogic method getFeedbackSessionResultsForInstructorFromSection.

/**
 * Gets results of  a feedback session to show to an instructor from a specific section.
 */
public FeedbackSessionResultsBundle getFeedbackSessionResultsForInstructorFromSection(String feedbackSessionName, String courseId, String userEmail, String section) throws EntityDoesNotExistException {
    CourseRoster roster = new CourseRoster(studentsLogic.getStudentsForCourse(courseId), instructorsLogic.getInstructorsForCourse(courseId));
    Map<String, String> params = new HashMap<>();
    params.put(PARAM_IS_INCLUDE_RESPONSE_STATUS, "false");
    params.put(PARAM_IN_SECTION, "false");
    params.put(PARAM_FROM_SECTION, "true");
    params.put(PARAM_TO_SECTION, "false");
    params.put(PARAM_SECTION, section);
    return getFeedbackSessionResultsForUserWithParams(feedbackSessionName, courseId, userEmail, UserRole.INSTRUCTOR, roster, params);
}
Also used : HashMap(java.util.HashMap) CourseRoster(teammates.common.datatransfer.CourseRoster)

Example 7 with CourseRoster

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

the class FeedbackSessionsLogic method getFeedbackSessionResultsForInstructorToSectionWithinRange.

/**
 * Gets results of a feedback session to show to an instructor in a section in an indicated range.
 */
public FeedbackSessionResultsBundle getFeedbackSessionResultsForInstructorToSectionWithinRange(String feedbackSessionName, String courseId, String userEmail, String section, int range) throws EntityDoesNotExistException {
    CourseRoster roster = new CourseRoster(studentsLogic.getStudentsForCourse(courseId), instructorsLogic.getInstructorsForCourse(courseId));
    Map<String, String> params = new HashMap<>();
    params.put(PARAM_IS_INCLUDE_RESPONSE_STATUS, "true");
    params.put(PARAM_IN_SECTION, "false");
    params.put(PARAM_FROM_SECTION, "false");
    params.put(PARAM_TO_SECTION, "true");
    params.put(PARAM_SECTION, section);
    if (range > 0) {
        params.put(PARAM_RANGE, String.valueOf(range));
    }
    return getFeedbackSessionResultsForUserWithParams(feedbackSessionName, courseId, userEmail, UserRole.INSTRUCTOR, roster, params);
}
Also used : HashMap(java.util.HashMap) CourseRoster(teammates.common.datatransfer.CourseRoster)

Example 8 with CourseRoster

use of teammates.common.datatransfer.CourseRoster 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)

Example 9 with CourseRoster

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

the class FeedbackSessionsLogic method getFeedbackSessionResultsForInstructorInSection.

/**
 * Gets results of a feedback session to show to an instructor for a specific section.
 */
public FeedbackSessionResultsBundle getFeedbackSessionResultsForInstructorInSection(String feedbackSessionName, String courseId, String userEmail, String section) throws EntityDoesNotExistException {
    CourseRoster roster = new CourseRoster(studentsLogic.getStudentsForCourse(courseId), instructorsLogic.getInstructorsForCourse(courseId));
    Map<String, String> params = new HashMap<>();
    params.put(PARAM_IS_INCLUDE_RESPONSE_STATUS, "true");
    params.put(PARAM_IN_SECTION, "true");
    params.put(PARAM_FROM_SECTION, "false");
    params.put(PARAM_TO_SECTION, "false");
    params.put(PARAM_SECTION, section);
    return getFeedbackSessionResultsForUserWithParams(feedbackSessionName, courseId, userEmail, UserRole.INSTRUCTOR, roster, params);
}
Also used : HashMap(java.util.HashMap) CourseRoster(teammates.common.datatransfer.CourseRoster)

Example 10 with CourseRoster

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

the class FeedbackSessionsLogic method getFeedbackSessionResultsForInstructorFromQuestion.

/**
 * Gets results of a feedback session to show to an instructor from an indicated question.
 * This will not retrieve the list of comments for this question.
 */
public FeedbackSessionResultsBundle getFeedbackSessionResultsForInstructorFromQuestion(String feedbackSessionName, String courseId, String userEmail, String questionId) throws EntityDoesNotExistException {
    // Load details of students and instructors once and pass it to callee
    // methods
    // (rather than loading them many times).
    CourseRoster roster = new CourseRoster(studentsLogic.getStudentsForCourse(courseId), instructorsLogic.getInstructorsForCourse(courseId));
    Map<String, String> params = new HashMap<>();
    params.put(PARAM_IS_INCLUDE_RESPONSE_STATUS, "true");
    params.put(PARAM_IN_SECTION, "false");
    params.put(PARAM_FROM_SECTION, "false");
    params.put(PARAM_TO_SECTION, "false");
    params.put(PARAM_QUESTION_ID, questionId);
    return getFeedbackSessionResultsForUserWithParams(feedbackSessionName, courseId, userEmail, UserRole.INSTRUCTOR, roster, params);
}
Also used : HashMap(java.util.HashMap) CourseRoster(teammates.common.datatransfer.CourseRoster)

Aggregations

CourseRoster (teammates.common.datatransfer.CourseRoster)12 HashMap (java.util.HashMap)9 FeedbackQuestionAttributes (teammates.common.datatransfer.attributes.FeedbackQuestionAttributes)3 FeedbackResponseAttributes (teammates.common.datatransfer.attributes.FeedbackResponseAttributes)2 FeedbackSessionAttributes (teammates.common.datatransfer.attributes.FeedbackSessionAttributes)2 InstructorAttributes (teammates.common.datatransfer.attributes.InstructorAttributes)2 StudentAttributes (teammates.common.datatransfer.attributes.StudentAttributes)2 EntityDoesNotExistException (teammates.common.exception.EntityDoesNotExistException)2 Instant (java.time.Instant)1 ArrayList (java.util.ArrayList)1 Comparator (java.util.Comparator)1 Date (java.util.Date)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 Test (org.testng.annotations.Test)1 FeedbackParticipantType (teammates.common.datatransfer.FeedbackParticipantType)1 FeedbackSessionDetailsBundle (teammates.common.datatransfer.FeedbackSessionDetailsBundle)1