Search in sources :

Example 1 with FeedbackResponseAttributes

use of teammates.common.datatransfer.attributes.FeedbackResponseAttributes in project teammates by TEAMMATES.

the class InstructorFeedbackEditPageUiTest method testResponseRate.

private void testResponseRate() {
    // Create a new question and save
    feedbackEditPage.clickNewQuestionButton();
    feedbackEditPage.selectNewQuestionType("TEXT");
    feedbackEditPage.fillQuestionTextBoxForNewQuestion("new question");
    feedbackEditPage.fillQuestionDescriptionForNewQuestion("more details");
    feedbackEditPage.clickAddQuestionButton();
    // Create response for the new question
    FeedbackResponseAttributes feedbackResponse = new FeedbackResponseAttributes(feedbackSessionName, courseId, "1", FeedbackQuestionType.TEXT, "tmms.test@gmail.tmt", Const.DEFAULT_SECTION, "alice.b.tmms@gmail.tmt", Const.DEFAULT_SECTION, new Text("Response from instructor to Alice"));
    BackDoor.createFeedbackResponse(feedbackResponse);
    ______TS("check response rate before editing question");
    InstructorFeedbackSessionsPage feedbacksPage = navigateToInstructorFeedbackSessionsPage();
    feedbacksPage.waitForAjaxLoaderGifToDisappear();
    feedbacksPage.clickViewResponseLink(courseId, feedbackSessionName);
    feedbacksPage.verifyResponseValue("1 / 1", courseId, feedbackSessionName);
    ______TS("check warning is displayed while editing visibility options of question with existing response");
    // Change the feedback path of the question and save
    feedbackEditPage = getFeedbackEditPage();
    assertTrue(feedbackEditPage.isAlertClassEnabledForVisibilityOptions(1));
    feedbackEditPage.clickEditQuestionButton(1);
    feedbackEditPage.enableOtherFeedbackPathOptions(1);
    feedbackEditPage.selectRecipientToBe(FeedbackParticipantType.TEAMS, 1);
    feedbackEditPage.clickSaveExistingQuestionButton(1);
    feedbackEditPage.waitForConfirmationModalAndClickOk();
    ______TS("check no warning displayed while editing visibility options of question without responses");
    assertFalse(feedbackEditPage.isAlertClassEnabledForVisibilityOptions(1));
    ______TS("check response rate after editing question");
    feedbacksPage = navigateToInstructorFeedbackSessionsPage();
    feedbacksPage.waitForAjaxLoaderGifToDisappear();
    feedbacksPage.clickViewResponseLink(courseId, feedbackSessionName);
    feedbacksPage.verifyResponseValue("0 / 1", courseId, feedbackSessionName);
    // Delete the question
    feedbackEditPage = getFeedbackEditPage();
    feedbackEditPage.clickDeleteQuestionLink(1);
    feedbackEditPage.waitForConfirmationModalAndClickOk();
}
Also used : InstructorFeedbackSessionsPage(teammates.test.pageobjects.InstructorFeedbackSessionsPage) FeedbackResponseAttributes(teammates.common.datatransfer.attributes.FeedbackResponseAttributes) Text(com.google.appengine.api.datastore.Text)

Example 2 with FeedbackResponseAttributes

use of teammates.common.datatransfer.attributes.FeedbackResponseAttributes in project teammates by TEAMMATES.

the class InstructorSubmissionAdjustmentUiTest method getAllResponsesForStudentForSession.

private List<FeedbackResponseAttributes> getAllResponsesForStudentForSession(StudentAttributes student, String feedbackSessionName) {
    List<FeedbackResponseAttributes> returnList = new ArrayList<>();
    List<FeedbackResponseAttributes> allResponseOfStudent = getAllTeamResponsesForStudent(student);
    for (FeedbackResponseAttributes responseAttributes : allResponseOfStudent) {
        if (responseAttributes.feedbackSessionName.equals(feedbackSessionName)) {
            returnList.add(responseAttributes);
        }
    }
    return returnList;
}
Also used : FeedbackResponseAttributes(teammates.common.datatransfer.attributes.FeedbackResponseAttributes) ArrayList(java.util.ArrayList)

Example 3 with FeedbackResponseAttributes

use of teammates.common.datatransfer.attributes.FeedbackResponseAttributes in project teammates by TEAMMATES.

the class InstructorSubmissionAdjustmentUiTest method testAdjustmentOfSubmission.

@Test
public void testAdjustmentOfSubmission() throws MaximumRetriesExceededException {
    // load the enrollPage
    loadEnrollmentPage();
    ______TS("typical case: enroll new student to existing course");
    StudentAttributes newStudent = StudentAttributes.builder("idOfTypicalCourse1", "someName", "random@g.tmt").withComments("comments").withTeam("Team 1.1</td></div>'\"").withSection("None").build();
    String enrollString = "Section | Team | Name | Email | Comment" + System.lineSeparator() + newStudent.toEnrollmentString();
    enrollPage.enroll(enrollString);
    // Wait briefly to allow task queue to successfully execute tasks
    ThreadHelper.waitFor(2000);
    ______TS("typical case : existing student changes team");
    loadEnrollmentPage();
    final FeedbackSessionAttributes session = testData.feedbackSessions.get("session2InCourse1");
    final StudentAttributes student = testData.students.get("student1InCourse1");
    // Verify pre-existing submissions and responses
    List<FeedbackResponseAttributes> oldResponsesForSession = getAllResponsesForStudentForSession(student, session.getFeedbackSessionName());
    assertFalse(oldResponsesForSession.isEmpty());
    String newTeam = "Team 1.2";
    student.team = newTeam;
    enrollString = "Section | Team | Name | Email | Comment" + System.lineSeparator() + student.toEnrollmentString();
    enrollPage.enroll(enrollString);
    // It might take a while for the submission adjustment to persist (especially on the live server),
    // during which the pre-existing submissions and responses would be counted.
    // Hence, this needs to be retried several times until the count becomes zero.
    persistenceRetryManager.runUntilSuccessful(new RetryableTaskReturns<Integer>("Assert outdated responses removed") {

        @Override
        public Integer run() {
            return getAllResponsesForStudentForSession(student, session.getFeedbackSessionName()).size();
        }

        @Override
        public boolean isSuccessful(Integer numberOfResponses) {
            return numberOfResponses == 0;
        }
    });
}
Also used : FeedbackSessionAttributes(teammates.common.datatransfer.attributes.FeedbackSessionAttributes) FeedbackResponseAttributes(teammates.common.datatransfer.attributes.FeedbackResponseAttributes) StudentAttributes(teammates.common.datatransfer.attributes.StudentAttributes) Test(org.testng.annotations.Test)

Example 4 with FeedbackResponseAttributes

use of teammates.common.datatransfer.attributes.FeedbackResponseAttributes in project teammates by TEAMMATES.

the class FeedbackResponseAdjustmentWorkerActionTest method allTests.

@Test
public void allTests() throws Exception {
    ______TS("typical case : existing student changes team");
    FeedbackSessionAttributes session = dataBundle.feedbackSessions.get("session2InCourse1");
    StudentAttributes student = dataBundle.students.get("student1InCourse1");
    // Verify pre-existing submissions and responses
    List<FeedbackResponseAttributes> oldResponsesForSession = getAllResponsesForStudentForSession(student, session.getFeedbackSessionName());
    assertFalse(oldResponsesForSession.isEmpty());
    String oldTeam = student.team;
    String oldSection = student.section;
    String newTeam = "Team 1.2";
    String newSection = "Section 2";
    student.team = newTeam;
    student.section = newSection;
    StudentEnrollDetails enrollDetails = new StudentEnrollDetails(StudentUpdateStatus.MODIFIED, student.course, student.email, oldTeam, newTeam, oldSection, newSection);
    List<StudentEnrollDetails> enrollList = new ArrayList<>();
    enrollList.add(enrollDetails);
    studentsLogic.updateStudentCascadeWithSubmissionAdjustmentScheduled(student.email, student, false);
    String[] submissionParams = new String[] { ParamsNames.COURSE_ID, student.course, ParamsNames.FEEDBACK_SESSION_NAME, session.getFeedbackSessionName(), ParamsNames.ENROLLMENT_DETAILS, JsonUtils.toJson(enrollList) };
    FeedbackResponseAdjustmentWorkerAction action = getAction(submissionParams);
    action.execute();
    List<FeedbackResponseAttributes> newResponsesForSession = getAllResponsesForStudentForSession(student, session.getFeedbackSessionName());
    assertTrue(newResponsesForSession.isEmpty());
}
Also used : FeedbackSessionAttributes(teammates.common.datatransfer.attributes.FeedbackSessionAttributes) FeedbackResponseAttributes(teammates.common.datatransfer.attributes.FeedbackResponseAttributes) ArrayList(java.util.ArrayList) FeedbackResponseAdjustmentWorkerAction(teammates.ui.automated.FeedbackResponseAdjustmentWorkerAction) StudentEnrollDetails(teammates.common.datatransfer.StudentEnrollDetails) StudentAttributes(teammates.common.datatransfer.attributes.StudentAttributes) Test(org.testng.annotations.Test)

Example 5 with FeedbackResponseAttributes

use of teammates.common.datatransfer.attributes.FeedbackResponseAttributes in project teammates by TEAMMATES.

the class FeedbackResponseAdjustmentWorkerActionTest method getAllTeamResponsesForStudent.

private List<FeedbackResponseAttributes> getAllTeamResponsesForStudent(StudentAttributes student) {
    List<FeedbackResponseAttributes> returnList = new ArrayList<>();
    List<FeedbackResponseAttributes> studentReceiverResponses = frLogic.getFeedbackResponsesForReceiverForCourse(student.course, student.email);
    for (FeedbackResponseAttributes response : studentReceiverResponses) {
        FeedbackQuestionAttributes question = fqLogic.getFeedbackQuestion(response.feedbackQuestionId);
        if (question.recipientType == FeedbackParticipantType.OWN_TEAM_MEMBERS) {
            returnList.add(response);
        }
    }
    List<FeedbackResponseAttributes> studentGiverResponses = frLogic.getFeedbackResponsesFromGiverForCourse(student.course, student.email);
    for (FeedbackResponseAttributes response : studentGiverResponses) {
        FeedbackQuestionAttributes question = fqLogic.getFeedbackQuestion(response.feedbackQuestionId);
        if (question.giverType == FeedbackParticipantType.TEAMS || question.recipientType == FeedbackParticipantType.OWN_TEAM_MEMBERS) {
            returnList.add(response);
        }
    }
    return returnList;
}
Also used : FeedbackResponseAttributes(teammates.common.datatransfer.attributes.FeedbackResponseAttributes) ArrayList(java.util.ArrayList) FeedbackQuestionAttributes(teammates.common.datatransfer.attributes.FeedbackQuestionAttributes)

Aggregations

FeedbackResponseAttributes (teammates.common.datatransfer.attributes.FeedbackResponseAttributes)143 FeedbackQuestionAttributes (teammates.common.datatransfer.attributes.FeedbackQuestionAttributes)70 ArrayList (java.util.ArrayList)63 StudentAttributes (teammates.common.datatransfer.attributes.StudentAttributes)36 InstructorAttributes (teammates.common.datatransfer.attributes.InstructorAttributes)35 List (java.util.List)29 FeedbackSessionAttributes (teammates.common.datatransfer.attributes.FeedbackSessionAttributes)28 HashMap (java.util.HashMap)27 FeedbackResponseCommentAttributes (teammates.common.datatransfer.attributes.FeedbackResponseCommentAttributes)22 HashSet (java.util.HashSet)20 LinkedHashMap (java.util.LinkedHashMap)20 Map (java.util.Map)18 Test (org.testng.annotations.Test)18 FeedbackQuestionsDb (teammates.storage.api.FeedbackQuestionsDb)18 FeedbackResponsesDb (teammates.storage.api.FeedbackResponsesDb)18 Text (com.google.appengine.api.datastore.Text)15 Set (java.util.Set)11 EntityDoesNotExistException (teammates.common.exception.EntityDoesNotExistException)10 Comparator (java.util.Comparator)9 FeedbackParticipantType (teammates.common.datatransfer.FeedbackParticipantType)9