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