use of teammates.common.datatransfer.attributes.FeedbackQuestionAttributes 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;
}
use of teammates.common.datatransfer.attributes.FeedbackQuestionAttributes in project teammates by TEAMMATES.
the class InstructorEditStudentFeedbackPageUiTest method testAddResponse.
private void testAddResponse() throws Exception {
______TS("test new response");
submitPage.fillResponseTextBox(2, 0, "4");
submitPage.clickSubmitButton();
submitPage.waitForTextsForAllStatusMessagesToUserEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED);
FeedbackQuestionAttributes fq = BackDoor.getFeedbackQuestion("IESFPTCourse", "First feedback session", 2);
FeedbackResponseAttributes fr = BackDoor.getFeedbackResponse(fq.getId(), "student1InIESFPTCourse@gmail.tmt", "student1InIESFPTCourse@gmail.tmt");
assertEquals("4", fr.getResponseDetails().getAnswerString());
// Full HTML verification already done in InstructorFeedbackSubmitPageUiTest
submitPage.verifyHtmlMainContent("/instructorEditStudentFeedbackPageModified.html");
submitPage.verifyAndCloseSuccessfulSubmissionModal();
}
use of teammates.common.datatransfer.attributes.FeedbackQuestionAttributes in project teammates by TEAMMATES.
the class InstructorEditStudentFeedbackPageUiTest method testEditResponse.
private void testEditResponse() throws Exception {
______TS("edit responses");
FeedbackQuestionAttributes fq = BackDoor.getFeedbackQuestion("IESFPTCourse", "First feedback session", 1);
FeedbackResponseAttributes fr = BackDoor.getFeedbackResponse(fq.getId(), "student1InIESFPTCourse@gmail.tmt", "student1InIESFPTCourse@gmail.tmt");
assertEquals("Student 1 self feedback.", fr.getResponseDetails().getAnswerString());
submitPage = loginToInstructorEditStudentFeedbackPage("IESFPTCourseinstr", "student1InIESFPTCourse@gmail.tmt", "session1InIESFPTCourse");
// Full HTML verification already done in InstructorFeedbackSubmitPageUiTest
submitPage.verifyHtmlMainContent("/instructorEditStudentFeedbackPageOpen.html");
submitPage.fillResponseRichTextEditor(1, 0, "Good design");
submitPage.clickSubmitButton();
submitPage.waitForTextsForAllStatusMessagesToUserEquals(Const.StatusMessages.FEEDBACK_RESPONSES_SAVED);
submitPage.verifyAndCloseSuccessfulSubmissionModal();
fq = BackDoor.getFeedbackQuestion("IESFPTCourse", "First feedback session", 1);
fr = BackDoor.getFeedbackResponse(fq.getId(), "student1InIESFPTCourse@gmail.tmt", "student1InIESFPTCourse@gmail.tmt");
assertEquals("<p>Good design</p>", fr.getResponseDetails().getAnswerString());
}
use of teammates.common.datatransfer.attributes.FeedbackQuestionAttributes in project teammates by TEAMMATES.
the class InstructorFeedbackQuestionEditActionTest method testExecuteAndPostProcessResponseRate.
@Test
public void testExecuteAndPostProcessResponseRate() throws Exception {
removeAndRestoreTypicalDataBundle();
gaeSimulation.loginAsInstructor(typicalBundle.instructors.get("instructor1OfCourse1").googleId);
FeedbackSessionsLogic fsLogic = FeedbackSessionsLogic.inst();
FeedbackQuestionsLogic fqLogic = FeedbackQuestionsLogic.inst();
FeedbackSessionAttributes fs = typicalBundle.feedbackSessions.get("session1InCourse1");
int numStudentRespondents = 3;
int numInstructorRespondents = 1;
int totalStudents = 5;
int totalInstructors = 5;
______TS("Check response rate before editing question 1");
fs = fsLogic.getFeedbackSession(fs.getFeedbackSessionName(), fs.getCourseId());
FeedbackSessionDetailsBundle details = fsLogic.getFeedbackSessionDetails(fs);
assertEquals(numStudentRespondents + numInstructorRespondents, details.stats.submittedTotal);
assertEquals(totalStudents + totalInstructors, details.stats.expectedTotal);
______TS("Change the feedback path of a question with no unique respondents");
FeedbackQuestionAttributes fq = fqLogic.getFeedbackQuestion(fs.getFeedbackSessionName(), fs.getCourseId(), 1);
String[] params1 = { Const.ParamsNames.COURSE_ID, fq.courseId, Const.ParamsNames.FEEDBACK_SESSION_NAME, fq.feedbackSessionName, Const.ParamsNames.FEEDBACK_QUESTION_GIVERTYPE, FeedbackParticipantType.STUDENTS.toString(), Const.ParamsNames.FEEDBACK_QUESTION_RECIPIENTTYPE, FeedbackParticipantType.STUDENTS.toString(), Const.ParamsNames.FEEDBACK_QUESTION_NUMBER, Integer.toString(fq.questionNumber), Const.ParamsNames.FEEDBACK_QUESTION_TYPE, fq.getQuestionType().toString(), Const.ParamsNames.FEEDBACK_QUESTION_TEXT, "What is the best selling point of your product?", Const.ParamsNames.FEEDBACK_QUESTION_DESCRIPTION, "more details", Const.ParamsNames.FEEDBACK_QUESTION_NUMBEROFENTITIESTYPE, "1", Const.ParamsNames.FEEDBACK_QUESTION_SHOWRESPONSESTO, FeedbackParticipantType.INSTRUCTORS.toString(), Const.ParamsNames.FEEDBACK_QUESTION_SHOWGIVERTO, FeedbackParticipantType.INSTRUCTORS.toString(), Const.ParamsNames.FEEDBACK_QUESTION_SHOWRECIPIENTTO, FeedbackParticipantType.INSTRUCTORS.toString(), Const.ParamsNames.FEEDBACK_QUESTION_EDITTYPE, "edit", Const.ParamsNames.FEEDBACK_QUESTION_ID, fq.getId() };
InstructorFeedbackQuestionEditAction a = getAction(params1);
a.executeAndPostProcess();
// Response rate should not change because other questions have the same respondents
fs = fsLogic.getFeedbackSession(fs.getFeedbackSessionName(), fs.getCourseId());
details = fsLogic.getFeedbackSessionDetails(fs);
assertEquals(numStudentRespondents + numInstructorRespondents, details.stats.submittedTotal);
assertEquals(totalStudents + totalInstructors, details.stats.expectedTotal);
______TS("Change the feedback path of a question with a unique instructor respondent");
fq = fqLogic.getFeedbackQuestion(fs.getFeedbackSessionName(), fs.getCourseId(), 3);
String[] params3 = { Const.ParamsNames.COURSE_ID, fq.courseId, Const.ParamsNames.FEEDBACK_SESSION_NAME, fq.feedbackSessionName, Const.ParamsNames.FEEDBACK_QUESTION_GIVERTYPE, fq.getGiverType().toString(), Const.ParamsNames.FEEDBACK_QUESTION_RECIPIENTTYPE, FeedbackParticipantType.STUDENTS.toString(), Const.ParamsNames.FEEDBACK_QUESTION_NUMBER, Integer.toString(fq.questionNumber), Const.ParamsNames.FEEDBACK_QUESTION_TYPE, fq.getQuestionType().toString(), Const.ParamsNames.FEEDBACK_QUESTION_TEXT, "My comments on the class", Const.ParamsNames.FEEDBACK_QUESTION_DESCRIPTION, "more details", Const.ParamsNames.FEEDBACK_QUESTION_NUMBEROFENTITIESTYPE, "1", Const.ParamsNames.FEEDBACK_QUESTION_SHOWRESPONSESTO, FeedbackParticipantType.INSTRUCTORS.toString(), Const.ParamsNames.FEEDBACK_QUESTION_SHOWGIVERTO, FeedbackParticipantType.INSTRUCTORS.toString(), Const.ParamsNames.FEEDBACK_QUESTION_SHOWRECIPIENTTO, FeedbackParticipantType.INSTRUCTORS.toString(), Const.ParamsNames.FEEDBACK_QUESTION_EDITTYPE, "edit", Const.ParamsNames.FEEDBACK_QUESTION_ID, fq.getId() };
a = getAction(params3);
a.executeAndPostProcess();
// Response rate should decrease by 1 because the response of the unique instructor respondent is deleted
fs = fsLogic.getFeedbackSession(fs.getFeedbackSessionName(), fs.getCourseId());
details = fsLogic.getFeedbackSessionDetails(fs);
assertEquals(numStudentRespondents, details.stats.submittedTotal);
assertEquals(totalStudents + totalInstructors, details.stats.expectedTotal);
______TS("Change the feedback path of a question so that some possible respondents are removed");
fq = fqLogic.getFeedbackQuestion(fs.getFeedbackSessionName(), fs.getCourseId(), 4);
String[] params4 = { Const.ParamsNames.COURSE_ID, fq.courseId, Const.ParamsNames.FEEDBACK_SESSION_NAME, fq.feedbackSessionName, Const.ParamsNames.FEEDBACK_QUESTION_GIVERTYPE, FeedbackParticipantType.STUDENTS.toString(), Const.ParamsNames.FEEDBACK_QUESTION_RECIPIENTTYPE, FeedbackParticipantType.NONE.toString(), Const.ParamsNames.FEEDBACK_QUESTION_NUMBER, Integer.toString(fq.questionNumber), Const.ParamsNames.FEEDBACK_QUESTION_TYPE, fq.getQuestionType().toString(), Const.ParamsNames.FEEDBACK_QUESTION_TEXT, "Instructor comments on the class", Const.ParamsNames.FEEDBACK_QUESTION_DESCRIPTION, "more details", Const.ParamsNames.FEEDBACK_QUESTION_NUMBEROFENTITIESTYPE, "1", Const.ParamsNames.FEEDBACK_QUESTION_SHOWRESPONSESTO, FeedbackParticipantType.INSTRUCTORS.toString(), Const.ParamsNames.FEEDBACK_QUESTION_SHOWGIVERTO, FeedbackParticipantType.INSTRUCTORS.toString(), Const.ParamsNames.FEEDBACK_QUESTION_SHOWRECIPIENTTO, FeedbackParticipantType.INSTRUCTORS.toString(), Const.ParamsNames.FEEDBACK_QUESTION_EDITTYPE, "edit", Const.ParamsNames.FEEDBACK_QUESTION_ID, fq.getId() };
a = getAction(params4);
a.executeAndPostProcess();
// Total possible respondents should decrease because instructors
// (except session creator) are no longer possible respondents
fs = fsLogic.getFeedbackSession(fs.getFeedbackSessionName(), fs.getCourseId());
details = fsLogic.getFeedbackSessionDetails(fs);
assertEquals(numStudentRespondents, details.stats.submittedTotal);
assertEquals(totalStudents + 1, details.stats.expectedTotal);
}
use of teammates.common.datatransfer.attributes.FeedbackQuestionAttributes in project teammates by TEAMMATES.
the class InstructorFeedbackQuestionEditActionTest method testExecuteAndPostProcessNumScale.
@Test
public void testExecuteAndPostProcessNumScale() {
DataBundle dataBundle = loadDataBundle("/FeedbackSessionQuestionTypeTest.json");
removeAndRestoreDataBundle(dataBundle);
InstructorAttributes instructor1ofCourse1 = dataBundle.instructors.get("instructor1OfCourse1");
gaeSimulation.loginAsInstructor(instructor1ofCourse1.googleId);
FeedbackSessionAttributes fs = dataBundle.feedbackSessions.get("numscaleSession");
FeedbackQuestionAttributes fq = FeedbackQuestionsLogic.inst().getFeedbackQuestion(fs.getFeedbackSessionName(), fs.getCourseId(), 1);
FeedbackNumericalScaleQuestionDetails numscaleDetails = (FeedbackNumericalScaleQuestionDetails) fq.getQuestionDetails();
FeedbackResponsesDb frDb = new FeedbackResponsesDb();
______TS("Edit text");
// There are already responses for this question
assertFalse(frDb.getFeedbackResponsesForQuestion(fq.getId()).isEmpty());
String[] editTextParams = { Const.ParamsNames.COURSE_ID, fs.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getFeedbackSessionName(), Const.ParamsNames.FEEDBACK_QUESTION_GIVERTYPE, fq.giverType.toString(), Const.ParamsNames.FEEDBACK_QUESTION_RECIPIENTTYPE, fq.recipientType.toString(), Const.ParamsNames.FEEDBACK_QUESTION_NUMBER, Integer.toString(fq.questionNumber), Const.ParamsNames.FEEDBACK_QUESTION_TYPE, "NUMSCALE", Const.ParamsNames.FEEDBACK_QUESTION_TEXT, numscaleDetails.getQuestionText() + " (edited)", Const.ParamsNames.FEEDBACK_QUESTION_DESCRIPTION, "more details", Const.ParamsNames.FEEDBACK_QUESTION_NUMSCALE_MIN, Integer.toString(numscaleDetails.getMinScale()), Const.ParamsNames.FEEDBACK_QUESTION_NUMSCALE_MAX, Integer.toString(numscaleDetails.getMaxScale()), Const.ParamsNames.FEEDBACK_QUESTION_NUMSCALE_STEP, StringHelper.toDecimalFormatString(numscaleDetails.getStep()), Const.ParamsNames.FEEDBACK_QUESTION_NUMBEROFENTITIESTYPE, "max", Const.ParamsNames.FEEDBACK_QUESTION_SHOWRESPONSESTO, FeedbackParticipantType.INSTRUCTORS.toString(), Const.ParamsNames.FEEDBACK_QUESTION_SHOWGIVERTO, FeedbackParticipantType.INSTRUCTORS.toString(), Const.ParamsNames.FEEDBACK_QUESTION_SHOWRECIPIENTTO, FeedbackParticipantType.INSTRUCTORS.toString(), Const.ParamsNames.FEEDBACK_QUESTION_EDITTYPE, "edit", Const.ParamsNames.FEEDBACK_QUESTION_ID, fq.getId() };
InstructorFeedbackQuestionEditAction a = getAction(editTextParams);
RedirectResult r = getRedirectResult(a);
assertEquals(getPageResultDestination(Const.ActionURIs.INSTRUCTOR_FEEDBACK_EDIT_PAGE, "FSQTT.idOfTypicalCourse1", "NUMSCALE+Session", "FSQTT.idOfInstructor1OfCourse1", false), r.getDestinationWithParams());
assertEquals(Const.StatusMessages.FEEDBACK_QUESTION_EDITED, r.getStatusMessage());
assertFalse(r.isError);
// All existing response should remain
assertFalse(frDb.getFeedbackResponsesForQuestion(fq.getId()).isEmpty());
______TS("Edit scales");
String[] editScalesParams = { Const.ParamsNames.COURSE_ID, fs.getCourseId(), Const.ParamsNames.FEEDBACK_SESSION_NAME, fs.getFeedbackSessionName(), Const.ParamsNames.FEEDBACK_QUESTION_GIVERTYPE, fq.giverType.toString(), Const.ParamsNames.FEEDBACK_QUESTION_RECIPIENTTYPE, fq.recipientType.toString(), Const.ParamsNames.FEEDBACK_QUESTION_NUMBER, Integer.toString(fq.questionNumber), Const.ParamsNames.FEEDBACK_QUESTION_TYPE, "NUMSCALE", Const.ParamsNames.FEEDBACK_QUESTION_TEXT, numscaleDetails.getQuestionText() + " (edited)", Const.ParamsNames.FEEDBACK_QUESTION_DESCRIPTION, "more details", Const.ParamsNames.FEEDBACK_QUESTION_NUMSCALE_MIN, Integer.toString(1), Const.ParamsNames.FEEDBACK_QUESTION_NUMSCALE_MAX, Integer.toString(10), Const.ParamsNames.FEEDBACK_QUESTION_NUMSCALE_STEP, StringHelper.toDecimalFormatString(1.0), Const.ParamsNames.FEEDBACK_QUESTION_NUMBEROFENTITIESTYPE, "max", Const.ParamsNames.FEEDBACK_QUESTION_SHOWRESPONSESTO, FeedbackParticipantType.INSTRUCTORS.toString(), Const.ParamsNames.FEEDBACK_QUESTION_SHOWGIVERTO, FeedbackParticipantType.INSTRUCTORS.toString(), Const.ParamsNames.FEEDBACK_QUESTION_SHOWRECIPIENTTO, FeedbackParticipantType.INSTRUCTORS.toString(), Const.ParamsNames.FEEDBACK_QUESTION_EDITTYPE, "edit", Const.ParamsNames.FEEDBACK_QUESTION_ID, fq.getId() };
a = getAction(editScalesParams);
r = getRedirectResult(a);
assertEquals(getPageResultDestination(Const.ActionURIs.INSTRUCTOR_FEEDBACK_EDIT_PAGE, "FSQTT.idOfTypicalCourse1", "NUMSCALE+Session", "FSQTT.idOfInstructor1OfCourse1", false), r.getDestinationWithParams());
assertEquals(Const.StatusMessages.FEEDBACK_QUESTION_EDITED, r.getStatusMessage());
assertFalse(r.isError);
// All existing response should be deleted as the scales are edited
assertTrue(frDb.getFeedbackResponsesForQuestion(fq.getId()).isEmpty());
}
Aggregations