Search in sources :

Example 1 with FeedbackSessionResponseStatus

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

the class FeedbackSessionUpdateRespondentWorkerActionTest method verifyRespondentNotInSessionRespondentsList.

private void verifyRespondentNotInSessionRespondentsList(FeedbackSessionAttributes session, String respondentEmail, boolean isInstructor) throws EntityDoesNotExistException {
    FeedbackSessionResponseStatus responseStatus = fsLogic.getFeedbackSessionResponseStatus(session.getFeedbackSessionName(), session.getCourseId());
    assertTrue(responseStatus.getStudentsWhoDidNotRespond().contains(respondentEmail));
    if (!isInstructor) {
        assertFalse(responseStatus.getStudentsWhoResponded().contains(respondentEmail));
    }
}
Also used : FeedbackSessionResponseStatus(teammates.common.datatransfer.FeedbackSessionResponseStatus)

Example 2 with FeedbackSessionResponseStatus

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

the class FeedbackSessionUpdateRespondentWorkerActionTest method verifyRespondentInSessionRespondentsList.

private void verifyRespondentInSessionRespondentsList(FeedbackSessionAttributes session, String respondentEmail, boolean isInstructor) throws EntityDoesNotExistException {
    FeedbackSessionResponseStatus responseStatus = fsLogic.getFeedbackSessionResponseStatus(session.getFeedbackSessionName(), session.getCourseId());
    assertFalse(responseStatus.getStudentsWhoDidNotRespond().contains(respondentEmail));
    if (!isInstructor) {
        assertTrue(responseStatus.getStudentsWhoResponded().contains(respondentEmail));
    }
}
Also used : FeedbackSessionResponseStatus(teammates.common.datatransfer.FeedbackSessionResponseStatus)

Example 3 with FeedbackSessionResponseStatus

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

the class InstructorFeedbackRemindParticularStudentsPageAction method execute.

@Override
protected ActionResult execute() throws EntityDoesNotExistException {
    String courseId = getRequestParamValue(Const.ParamsNames.COURSE_ID);
    Assumption.assertPostParamNotNull(Const.ParamsNames.COURSE_ID, courseId);
    String feedbackSessionName = getRequestParamValue(Const.ParamsNames.FEEDBACK_SESSION_NAME);
    Assumption.assertPostParamNotNull(Const.ParamsNames.FEEDBACK_SESSION_NAME, feedbackSessionName);
    FeedbackSessionAttributes fsa = logic.getFeedbackSession(feedbackSessionName, courseId);
    InstructorAttributes instructor = logic.getInstructorForGoogleId(courseId, account.googleId);
    gateKeeper.verifyAccessible(instructor, fsa, false);
    FeedbackSessionResponseStatus fsResponseStatus = logic.getFeedbackSessionResponseStatus(feedbackSessionName, courseId);
    InstructorFeedbackRemindParticularStudentsPageData data = new InstructorFeedbackRemindParticularStudentsPageData(account, sessionToken, fsResponseStatus, courseId, feedbackSessionName);
    return createShowPageResult(Const.ViewURIs.INSTRUCTOR_FEEDBACK_AJAX_REMIND_PARTICULAR_STUDENTS_MODAL, data);
}
Also used : FeedbackSessionAttributes(teammates.common.datatransfer.attributes.FeedbackSessionAttributes) FeedbackSessionResponseStatus(teammates.common.datatransfer.FeedbackSessionResponseStatus) InstructorFeedbackRemindParticularStudentsPageData(teammates.ui.pagedata.InstructorFeedbackRemindParticularStudentsPageData) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes)

Example 4 with FeedbackSessionResponseStatus

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

the class FeedbackSessionsLogic method getFeedbackSessionResponseStatus.

private FeedbackSessionResponseStatus getFeedbackSessionResponseStatus(FeedbackSessionAttributes fsa, CourseRoster roster, List<FeedbackQuestionAttributes> questions) {
    FeedbackSessionResponseStatus responseStatus = new FeedbackSessionResponseStatus();
    List<StudentAttributes> students = roster.getStudents();
    List<InstructorAttributes> instructors = roster.getInstructors();
    List<FeedbackQuestionAttributes> studentQns = fqLogic.getFeedbackQuestionsForStudents(questions);
    List<String> studentNoResponses = new ArrayList<>();
    List<String> studentResponded = new ArrayList<>();
    List<String> instructorNoResponses = new ArrayList<>();
    if (!studentQns.isEmpty()) {
        for (StudentAttributes student : students) {
            studentNoResponses.add(student.email);
            responseStatus.emailNameTable.put(student.email, student.name);
            responseStatus.emailSectionTable.put(student.email, student.section);
            responseStatus.emailTeamNameTable.put(student.email, student.team);
        }
    }
    studentNoResponses.removeAll(fsa.getRespondingStudentList());
    studentResponded.addAll(fsa.getRespondingStudentList());
    for (InstructorAttributes instructor : instructors) {
        List<FeedbackQuestionAttributes> instructorQns = fqLogic.getFeedbackQuestionsForInstructor(questions, fsa.isCreator(instructor.email));
        if (!instructorQns.isEmpty() && responseStatus.emailNameTable.get(instructor.email) == null) {
            instructorNoResponses.add(instructor.email);
            responseStatus.emailNameTable.put(instructor.email, instructor.name);
        }
    }
    instructorNoResponses.removeAll(fsa.getRespondingInstructorList());
    responseStatus.studentsWhoDidNotRespond.addAll(studentNoResponses);
    responseStatus.studentsWhoResponded.addAll(studentResponded);
    responseStatus.studentsWhoDidNotRespond.addAll(instructorNoResponses);
    return responseStatus;
}
Also used : FeedbackSessionResponseStatus(teammates.common.datatransfer.FeedbackSessionResponseStatus) ArrayList(java.util.ArrayList) FeedbackQuestionAttributes(teammates.common.datatransfer.attributes.FeedbackQuestionAttributes) StudentAttributes(teammates.common.datatransfer.attributes.StudentAttributes) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes)

Example 5 with FeedbackSessionResponseStatus

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

the class FeedbackSessionsLogic method getFeedbackSessionResultsForUserWithParams.

private FeedbackSessionResultsBundle getFeedbackSessionResultsForUserWithParams(String feedbackSessionName, String courseId, String userEmail, UserRole role, CourseRoster roster, Map<String, String> params) throws EntityDoesNotExistException {
    FeedbackSessionAttributes session = fsDb.getFeedbackSession(courseId, feedbackSessionName);
    if (session == null) {
        throw new EntityDoesNotExistException(ERROR_NON_EXISTENT_FS_VIEW + courseId + "/" + feedbackSessionName);
    }
    List<FeedbackQuestionAttributes> allQuestions = fqLogic.getFeedbackQuestionsForSession(feedbackSessionName, courseId);
    // Show all questions even if no responses, unless is an ajax request for a specific question.
    Map<String, FeedbackQuestionAttributes> relevantQuestions = getAllQuestions(role, params, allQuestions);
    boolean isPrivateSessionNotCreatedByThisUser = session.isPrivateSession() && !session.isCreator(userEmail);
    if (isPrivateSessionNotCreatedByThisUser) {
        // return empty result set
        return new FeedbackSessionResultsBundle(session, relevantQuestions, roster);
    }
    boolean isIncludeResponseStatus = Boolean.parseBoolean(params.get(PARAM_IS_INCLUDE_RESPONSE_STATUS));
    String section = params.get(PARAM_SECTION);
    String questionId = params.get(PARAM_QUESTION_ID);
    if (questionId != null) {
        return getFeedbackSessionResultsForQuestionId(feedbackSessionName, courseId, userEmail, role, roster, session, allQuestions, relevantQuestions, isIncludeResponseStatus, section, questionId);
    }
    Map<String, FeedbackQuestionAttributes> allQuestionsMap = new HashMap<>();
    putQuestionsIntoMap(allQuestions, allQuestionsMap);
    List<FeedbackResponseAttributes> allResponses = getAllResponses(feedbackSessionName, courseId, params, section);
    String rangeString = params.get(PARAM_RANGE);
    boolean isComplete = rangeString == null || allResponses.size() <= Integer.parseInt(rangeString);
    if (!isComplete) {
        putQuestionsIntoMap(allQuestions, relevantQuestions);
    }
    // create empty data containers to store results
    List<FeedbackResponseAttributes> responses = new ArrayList<>();
    Map<String, String> emailNameTable = new HashMap<>();
    Map<String, String> emailLastNameTable = new HashMap<>();
    Map<String, String> emailTeamNameTable = new HashMap<>();
    Map<String, Set<String>> sectionTeamNameTable = new HashMap<>();
    Map<String, boolean[]> visibilityTable = new HashMap<>();
    FeedbackSessionResponseStatus responseStatus = section == null && isIncludeResponseStatus ? getFeedbackSessionResponseStatus(session, roster, allQuestions) : null;
    StudentAttributes student = getStudent(courseId, userEmail, role);
    Set<String> studentsEmailInTeam = getTeammateEmails(courseId, student);
    InstructorAttributes instructor = getInstructor(courseId, userEmail, role);
    Map<String, FeedbackResponseAttributes> relevantResponse = new HashMap<>();
    for (FeedbackResponseAttributes response : allResponses) {
        FeedbackQuestionAttributes relatedQuestion = allQuestionsMap.get(response.feedbackQuestionId);
        if (relatedQuestion != null) {
            boolean isVisibleResponse = isResponseVisibleForUser(userEmail, role, student, studentsEmailInTeam, response, relatedQuestion, instructor);
            if (isVisibleResponse) {
                responses.add(response);
                relevantResponse.put(response.getId(), response);
                relevantQuestions.put(relatedQuestion.getId(), relatedQuestion);
                addEmailNamePairsToTable(emailNameTable, response, relatedQuestion, roster);
                addEmailLastNamePairsToTable(emailLastNameTable, response, relatedQuestion, roster);
                addEmailTeamNamePairsToTable(emailTeamNameTable, response, relatedQuestion, roster);
                addVisibilityToTable(visibilityTable, relatedQuestion, response, userEmail, role, roster);
            }
        }
    }
    Map<String, List<FeedbackResponseCommentAttributes>> responseComments = getResponseComments(feedbackSessionName, courseId, userEmail, role, roster, relevantQuestions, section, student, studentsEmailInTeam, relevantResponse);
    addSectionTeamNamesToTable(sectionTeamNameTable, roster, courseId, userEmail, role, feedbackSessionName, section);
    return new FeedbackSessionResultsBundle(session, responses, relevantQuestions, emailNameTable, emailLastNameTable, emailTeamNameTable, sectionTeamNameTable, visibilityTable, responseStatus, roster, responseComments, isComplete);
}
Also used : HashSet(java.util.HashSet) Set(java.util.Set) HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) StudentAttributes(teammates.common.datatransfer.attributes.StudentAttributes) EntityDoesNotExistException(teammates.common.exception.EntityDoesNotExistException) FeedbackSessionResultsBundle(teammates.common.datatransfer.FeedbackSessionResultsBundle) InstructorAttributes(teammates.common.datatransfer.attributes.InstructorAttributes) FeedbackSessionAttributes(teammates.common.datatransfer.attributes.FeedbackSessionAttributes) FeedbackSessionResponseStatus(teammates.common.datatransfer.FeedbackSessionResponseStatus) FeedbackResponseAttributes(teammates.common.datatransfer.attributes.FeedbackResponseAttributes) FeedbackQuestionAttributes(teammates.common.datatransfer.attributes.FeedbackQuestionAttributes) ArrayList(java.util.ArrayList) List(java.util.List)

Aggregations

FeedbackSessionResponseStatus (teammates.common.datatransfer.FeedbackSessionResponseStatus)7 ArrayList (java.util.ArrayList)4 FeedbackQuestionAttributes (teammates.common.datatransfer.attributes.FeedbackQuestionAttributes)4 InstructorAttributes (teammates.common.datatransfer.attributes.InstructorAttributes)4 StudentAttributes (teammates.common.datatransfer.attributes.StudentAttributes)4 HashMap (java.util.HashMap)3 HashSet (java.util.HashSet)3 List (java.util.List)3 Set (java.util.Set)3 FeedbackSessionResultsBundle (teammates.common.datatransfer.FeedbackSessionResultsBundle)3 FeedbackResponseAttributes (teammates.common.datatransfer.attributes.FeedbackResponseAttributes)3 FeedbackSessionAttributes (teammates.common.datatransfer.attributes.FeedbackSessionAttributes)3 EntityDoesNotExistException (teammates.common.exception.EntityDoesNotExistException)2 FeedbackResponseCommentAttributes (teammates.common.datatransfer.attributes.FeedbackResponseCommentAttributes)1 InstructorFeedbackRemindParticularStudentsPageData (teammates.ui.pagedata.InstructorFeedbackRemindParticularStudentsPageData)1