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();
}
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;
}
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;
}
});
}
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());
}
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;
}
Aggregations