use of teammates.common.datatransfer.FeedbackParticipantType in project teammates by TEAMMATES.
the class FeedbackQuestionsLogic method getRecipientsForQuestion.
public Map<String, String> getRecipientsForQuestion(FeedbackQuestionAttributes question, String giver, InstructorAttributes instructorGiver, StudentAttributes studentGiver) throws EntityDoesNotExistException {
Map<String, String> recipients = new HashMap<>();
FeedbackParticipantType recipientType = question.recipientType;
String giverTeam = getGiverTeam(giver, instructorGiver, studentGiver);
switch(recipientType) {
case SELF:
if (question.giverType == FeedbackParticipantType.TEAMS) {
recipients.put(studentGiver.team, studentGiver.team);
} else {
recipients.put(giver, Const.USER_NAME_FOR_SELF);
}
break;
case STUDENTS:
List<StudentAttributes> studentsInCourse = studentsLogic.getStudentsForCourse(question.courseId);
for (StudentAttributes student : studentsInCourse) {
// Ensure student does not evaluate himself
if (!giver.equals(student.email)) {
recipients.put(student.email, student.name);
}
}
break;
case INSTRUCTORS:
List<InstructorAttributes> instructorsInCourse = instructorsLogic.getInstructorsForCourse(question.courseId);
for (InstructorAttributes instr : instructorsInCourse) {
// Ensure instructor does not evaluate himself
if (!giver.equals(instr.email)) {
recipients.put(instr.email, instr.name);
}
}
break;
case TEAMS:
List<TeamDetailsBundle> teams = coursesLogic.getTeamsForCourse(question.courseId);
for (TeamDetailsBundle team : teams) {
// Ensure student('s team) does not evaluate own team.
if (!giverTeam.equals(team.name)) {
// recipientEmail doubles as team name in this case.
recipients.put(team.name, team.name);
}
}
break;
case OWN_TEAM:
recipients.put(giverTeam, giverTeam);
break;
case OWN_TEAM_MEMBERS:
List<StudentAttributes> students = studentsLogic.getStudentsForTeam(giverTeam, question.courseId);
for (StudentAttributes student : students) {
if (!student.email.equals(giver)) {
recipients.put(student.email, student.name);
}
}
break;
case OWN_TEAM_MEMBERS_INCLUDING_SELF:
List<StudentAttributes> teamMembers = studentsLogic.getStudentsForTeam(giverTeam, question.courseId);
for (StudentAttributes student : teamMembers) {
// accepts self feedback too
recipients.put(student.email, student.name);
}
break;
case NONE:
recipients.put(Const.GENERAL_QUESTION, Const.GENERAL_QUESTION);
break;
default:
break;
}
return recipients;
}
use of teammates.common.datatransfer.FeedbackParticipantType in project teammates by TEAMMATES.
the class FeedbackSessionsLogic method addEmailNamePairsToTable.
private void addEmailNamePairsToTable(Map<String, String> emailNameTable, FeedbackResponseAttributes response, FeedbackQuestionAttributes question, CourseRoster roster, int pairType) {
if (question.giverType == FeedbackParticipantType.TEAMS && roster.isStudentInCourse(response.giver)) {
emailNameTable.putIfAbsent(response.giver + Const.TEAM_OF_EMAIL_OWNER, getNameTeamNamePairForEmail(question.giverType, response.giver, roster)[pairType]);
StudentAttributes studentGiver = roster.getStudentForEmail(response.giver);
if (studentGiver != null) {
emailNameTable.putIfAbsent(studentGiver.team, getNameTeamNamePairForEmail(question.giverType, response.giver, roster)[pairType]);
}
} else {
emailNameTable.putIfAbsent(response.giver, getNameTeamNamePairForEmail(question.giverType, response.giver, roster)[pairType]);
}
FeedbackParticipantType recipientType = null;
if (question.recipientType == FeedbackParticipantType.SELF) {
recipientType = question.giverType;
} else {
recipientType = question.recipientType;
}
emailNameTable.putIfAbsent(response.recipient, getNameTeamNamePairForEmail(recipientType, response.recipient, roster)[pairType]);
}
use of teammates.common.datatransfer.FeedbackParticipantType in project teammates by TEAMMATES.
the class InstructorFeedbackResultsPageData method getResponseVisibilityMap.
private Map<FeedbackParticipantType, Boolean> getResponseVisibilityMap(FeedbackQuestionAttributes question) {
Map<FeedbackParticipantType, Boolean> responseVisibilityMap = new HashMap<>();
FeedbackParticipantType[] relevantTypes = { FeedbackParticipantType.GIVER, FeedbackParticipantType.RECEIVER, FeedbackParticipantType.OWN_TEAM_MEMBERS, FeedbackParticipantType.RECEIVER_TEAM_MEMBERS, FeedbackParticipantType.STUDENTS, FeedbackParticipantType.INSTRUCTORS };
for (FeedbackParticipantType participantType : relevantTypes) {
responseVisibilityMap.put(participantType, isResponseVisibleTo(participantType, question));
}
return responseVisibilityMap;
}
use of teammates.common.datatransfer.FeedbackParticipantType in project teammates by TEAMMATES.
the class PageData method getTypeOfPeopleCanViewComment.
/**
* Returns the type of people that can view the response comment.
*/
public String getTypeOfPeopleCanViewComment(FeedbackResponseCommentAttributes comment, FeedbackQuestionAttributes relatedQuestion) {
StringBuilder peopleCanView = new StringBuilder(100);
List<FeedbackParticipantType> showCommentTo;
if (comment.isVisibilityFollowingFeedbackQuestion) {
showCommentTo = relatedQuestion.showResponsesTo;
} else {
showCommentTo = comment.showCommentTo;
}
for (int i = 0; i < showCommentTo.size(); i++) {
FeedbackParticipantType commentViewer = showCommentTo.get(i);
if (i == showCommentTo.size() - 1 && showCommentTo.size() > 1) {
peopleCanView.append("and ");
}
switch(commentViewer) {
case GIVER:
peopleCanView.append("response giver, ");
break;
case RECEIVER:
peopleCanView.append("response recipient, ");
break;
case OWN_TEAM:
peopleCanView.append("response giver's team, ");
break;
case RECEIVER_TEAM_MEMBERS:
peopleCanView.append("response recipient's team, ");
break;
case STUDENTS:
peopleCanView.append("other students in this course, ");
break;
case INSTRUCTORS:
peopleCanView.append("instructors, ");
break;
default:
break;
}
}
String peopleCanViewString = peopleCanView.toString();
return removeEndComma(peopleCanViewString);
}
use of teammates.common.datatransfer.FeedbackParticipantType in project teammates by TEAMMATES.
the class InstructorFeedbackEditPageData method configureVisibilitySettings.
private FeedbackQuestionVisibilitySettings configureVisibilitySettings(FeedbackQuestionAttributes question) {
Map<String, Boolean> isGiverNameVisibleFor = new HashMap<>();
for (FeedbackParticipantType giverType : question.showGiverNameTo) {
isGiverNameVisibleFor.put(giverType.name(), true);
}
Map<String, Boolean> isRecipientNameVisibleFor = new HashMap<>();
for (FeedbackParticipantType recipientType : question.showRecipientNameTo) {
isRecipientNameVisibleFor.put(recipientType.name(), true);
}
Map<String, Boolean> isResponsesVisibleFor = new HashMap<>();
for (FeedbackParticipantType participantType : question.showResponsesTo) {
isResponsesVisibleFor.put(participantType.name(), true);
}
String dropdownMenuLabel = getDropdownMenuLabel(question);
return new FeedbackQuestionVisibilitySettings(question.getVisibilityMessage(), isResponsesVisibleFor, isGiverNameVisibleFor, isRecipientNameVisibleFor, dropdownMenuLabel);
}
Aggregations