use of teammates.common.datatransfer.attributes.FeedbackQuestionAttributes in project teammates by TEAMMATES.
the class BackDoorLogic method processQuestionsAndPopulateMap.
private void processQuestionsAndPopulateMap(Collection<FeedbackQuestionAttributes> questions, SetMultimap<String, FeedbackQuestionAttributes> sessionQuestionsMap) {
for (FeedbackQuestionAttributes question : questions) {
question.removeIrrelevantVisibilityOptions();
String sessionKey = makeSessionKey(question.feedbackSessionName, question.courseId);
sessionQuestionsMap.put(sessionKey, question);
}
}
use of teammates.common.datatransfer.attributes.FeedbackQuestionAttributes in project teammates by TEAMMATES.
the class BackDoorLogic method makeQuestionKeys.
private List<String> makeQuestionKeys(List<FeedbackQuestionAttributes> questions, String sessionKey) {
List<String> questionKeys = new ArrayList<>();
for (FeedbackQuestionAttributes question : questions) {
String questionKey = makeQuestionKey(sessionKey, question.questionNumber);
questionKeys.add(questionKey);
}
return questionKeys;
}
use of teammates.common.datatransfer.attributes.FeedbackQuestionAttributes in project teammates by TEAMMATES.
the class BackDoorLogic method editFeedbackQuestionAsJson.
public void editFeedbackQuestionAsJson(String feedbackQuestionJson) throws InvalidParametersException, EntityDoesNotExistException {
FeedbackQuestionAttributes feedbackQuestion = JsonUtils.fromJson(feedbackQuestionJson, FeedbackQuestionAttributes.class);
updateFeedbackQuestion(feedbackQuestion);
}
use of teammates.common.datatransfer.attributes.FeedbackQuestionAttributes in project teammates by TEAMMATES.
the class BackDoorLogic method updateRespondents.
private void updateRespondents(FeedbackSessionAttributes session, Set<InstructorAttributes> courseInstructors, Set<FeedbackQuestionAttributes> sessionQuestions, Set<FeedbackResponseAttributes> sessionResponses) {
String sessionKey = makeSessionKey(session.getFeedbackSessionName(), session.getCourseId());
SetMultimap<String, String> instructorQuestionKeysMap = HashMultimap.create();
for (InstructorAttributes instructor : courseInstructors) {
List<FeedbackQuestionAttributes> questionsForInstructor = feedbackQuestionsLogic.getFeedbackQuestionsForInstructor(new ArrayList<>(sessionQuestions), session.isCreator(instructor.email));
List<String> questionKeys = makeQuestionKeys(questionsForInstructor, sessionKey);
instructorQuestionKeysMap.putAll(instructor.email, questionKeys);
}
Set<String> respondingInstructors = new HashSet<>();
Set<String> respondingStudents = new HashSet<>();
for (FeedbackResponseAttributes response : sessionResponses) {
String respondent = response.giver;
// contains question number before injection
String responseQuestionNumber = response.feedbackQuestionId;
String responseQuestionKey = makeQuestionKey(sessionKey, responseQuestionNumber);
Set<String> instructorQuestionKeys = instructorQuestionKeysMap.get(respondent);
if (instructorQuestionKeys.contains(responseQuestionKey)) {
respondingInstructors.add(respondent);
} else {
respondingStudents.add(respondent);
}
}
session.setRespondingInstructorList(respondingInstructors);
session.setRespondingStudentList(respondingStudents);
}
use of teammates.common.datatransfer.attributes.FeedbackQuestionAttributes in project teammates by TEAMMATES.
the class FeedbackSessionQuestionsBundle method hideUnmoderatableQuestions.
/**
* Removes question from the bundle if the question has givers or recipients that are anonymous to the instructor
* or responses that are hidden from the instructor.
*/
public void hideUnmoderatableQuestions() {
List<FeedbackQuestionAttributes> questionsToHide = new ArrayList<>();
for (FeedbackQuestionAttributes question : questionResponseBundle.keySet()) {
boolean isGiverVisibleToInstructor = question.showGiverNameTo.contains(FeedbackParticipantType.INSTRUCTORS);
boolean isRecipientVisibleToInstructor = question.showRecipientNameTo.contains(FeedbackParticipantType.INSTRUCTORS);
boolean isResponseVisibleToInstructor = question.showResponsesTo.contains(FeedbackParticipantType.INSTRUCTORS);
if (!isResponseVisibleToInstructor || !isGiverVisibleToInstructor || !isRecipientVisibleToInstructor) {
questionsToHide.add(question);
questionResponseBundle.put(question, new ArrayList<FeedbackResponseAttributes>());
}
}
questionResponseBundle.keySet().removeAll(questionsToHide);
}
Aggregations