use of teammates.ui.template.InstructorFeedbackResultsResponsePanel in project teammates by TEAMMATES.
the class InstructorFeedbackResultsPageData method buildResponsePanels.
private List<InstructorFeedbackResultsResponsePanel> buildResponsePanels(final String additionalInfoId, int primaryParticipantIndex, int secondaryRecipientIndex, List<FeedbackResponseAttributes> giverResponses) {
List<InstructorFeedbackResultsResponsePanel> responsePanels = new ArrayList<>();
for (int responseIndex = 0; responseIndex < giverResponses.size(); responseIndex++) {
FeedbackResponseAttributes response = giverResponses.get(responseIndex);
String questionId = response.feedbackQuestionId;
FeedbackQuestionAttributes question = bundle.questions.get(questionId);
String questionText = bundle.getQuestionText(questionId);
int giverIndex = viewType.isPrimaryGroupingOfGiverType() ? primaryParticipantIndex : secondaryRecipientIndex;
int recipientIndex = viewType.isPrimaryGroupingOfGiverType() ? secondaryRecipientIndex : primaryParticipantIndex;
String additionalInfoText = questionToDetailsMap.get(question).getQuestionAdditionalInfoHtml(question.getQuestionNumber(), String.format(additionalInfoId, giverIndex, recipientIndex));
String displayableResponse = bundle.getResponseAnswerHtml(response, question);
String giverName = bundle.getNameForEmail(response.giver);
String recipientName = bundle.getNameForEmail(response.recipient);
String giverTeam = bundle.getTeamNameForEmail(response.giver);
String recipientTeam = bundle.getTeamNameForEmail(response.recipient);
giverName = bundle.appendTeamNameToName(giverName, giverTeam);
recipientName = bundle.appendTeamNameToName(recipientName, recipientTeam);
List<FeedbackResponseCommentRow> comments = buildResponseComments(giverName, recipientName, question, response);
boolean isAllowedToSubmitSessionsInBothSection = instructor.isAllowedForPrivilege(response.giverSection, response.feedbackSessionName, Const.ParamsNames.INSTRUCTOR_PERMISSION_SUBMIT_SESSION_IN_SECTIONS) && instructor.isAllowedForPrivilege(response.recipientSection, response.feedbackSessionName, Const.ParamsNames.INSTRUCTOR_PERMISSION_SUBMIT_SESSION_IN_SECTIONS);
boolean isCommentsOnResponsesAllowed = question.getQuestionDetails().isCommentsOnResponsesAllowed();
Matcher matcher = sectionIdPattern.matcher(additionalInfoId);
if (matcher.find()) {
sectionId = Integer.parseInt(matcher.group(1));
}
InstructorFeedbackResultsResponsePanel responsePanel = new InstructorFeedbackResultsResponsePanel(question, response, questionText, sectionId, additionalInfoText, null, displayableResponse, comments, isAllowedToSubmitSessionsInBothSection, isCommentsOnResponsesAllowed);
responsePanel.setCommentsIndexes(recipientIndex, giverIndex, responseIndex + 1);
if (isCommentsOnResponsesAllowed) {
Map<FeedbackParticipantType, Boolean> responseVisibilityMap = getResponseVisibilityMap(question);
FeedbackResponseCommentRow frcForAdding = buildFeedbackResponseCommentAddForm(question, response, responseVisibilityMap, giverName, recipientName);
responsePanel.setFrcForAdding(frcForAdding);
}
responsePanels.add(responsePanel);
}
return responsePanels;
}
use of teammates.ui.template.InstructorFeedbackResultsResponsePanel in project teammates by TEAMMATES.
the class InstructorFeedbackResultsPageData method buildSecondaryParticipantPanels.
private List<InstructorFeedbackResultsSecondaryParticipantPanelBody> buildSecondaryParticipantPanels(String additionalInfoId, int primaryParticipantIndex, Map<String, List<FeedbackResponseAttributes>> secondaryParticipantToResponsesMap) {
List<InstructorFeedbackResultsSecondaryParticipantPanelBody> secondaryParticipantPanels = new ArrayList<>();
int secondaryParticipantIndex = 0;
for (Map.Entry<String, List<FeedbackResponseAttributes>> secondaryParticipantResponses : secondaryParticipantToResponsesMap.entrySet()) {
secondaryParticipantIndex += 1;
String secondaryParticipantIdentifier = secondaryParticipantResponses.getKey();
boolean isEmail = validator.getInvalidityInfoForEmail(secondaryParticipantIdentifier).isEmpty();
String secondaryParticipantDisplayableName;
if (isEmail && !bundle.getTeamNameForEmail(secondaryParticipantIdentifier).isEmpty()) {
secondaryParticipantDisplayableName = bundle.getNameForEmail(secondaryParticipantIdentifier) + " (" + bundle.getTeamNameForEmail(secondaryParticipantIdentifier) + ")";
} else {
secondaryParticipantDisplayableName = bundle.getNameForEmail(secondaryParticipantIdentifier);
}
List<InstructorFeedbackResultsResponsePanel> responsePanels = buildResponsePanels(additionalInfoId, primaryParticipantIndex, secondaryParticipantIndex, secondaryParticipantResponses.getValue());
InstructorFeedbackResultsSecondaryParticipantPanelBody secondaryParticipantPanel = new InstructorFeedbackResultsSecondaryParticipantPanelBody(secondaryParticipantIdentifier, secondaryParticipantDisplayableName, responsePanels);
secondaryParticipantPanel.setProfilePictureLink(getProfilePictureIfEmailValid(secondaryParticipantIdentifier));
if (!viewType.isPrimaryGroupingOfGiverType()) {
String sectionName = bundle.getSectionFromRoster(secondaryParticipantIdentifier);
boolean isAllowedToModerate = isAllowedToModerate(instructor, sectionName, feedbackSessionName);
secondaryParticipantPanel.setModerationButton(isAllowedToModerate ? buildModerationButtonForGiver(null, secondaryParticipantIdentifier, "btn btn-default btn-xs", MODERATE_RESPONSES_FOR_GIVER) : null);
}
secondaryParticipantPanels.add(secondaryParticipantPanel);
}
return secondaryParticipantPanels;
}
Aggregations