use of teammates.common.datatransfer.attributes.FeedbackQuestionAttributes in project teammates by TEAMMATES.
the class InstructorFeedbackResultsPageData method initForViewByQuestion.
/**
* Prepares question tables for viewing.
*
* <p>{@code bundle} should be set before this method
*/
public void initForViewByQuestion(InstructorAttributes instructor, String selectedSection, String showStats, String groupByTeam, boolean isMissingResponsesShown) {
this.viewType = InstructorFeedbackResultsPageViewType.QUESTION;
this.sortType = InstructorFeedbackResultsPageViewType.QUESTION.toString();
initCommonVariables(instructor, selectedSection, showStats, groupByTeam, isMissingResponsesShown);
Map<FeedbackQuestionAttributes, List<FeedbackResponseAttributes>> questionToResponseMap = bundle.getQuestionResponseMap();
questionPanels = new ArrayList<>();
// if there is more than one question, we omit generation of responseRows,
// and load them by ajax question by question
boolean isLoadingStructureOnly = questionToResponseMap.size() > 1;
questionToResponseMap.forEach((question, responses) -> {
InstructorFeedbackResultsQuestionTable questionPanel;
if (isLoadingStructureOnly) {
questionPanel = buildQuestionTableWithoutResponseRows(question, responses, "");
questionPanel.setHasResponses(false);
} else {
questionPanel = buildQuestionTableAndResponseRows(question, responses, "");
}
questionPanels.add(questionPanel);
});
}
use of teammates.common.datatransfer.attributes.FeedbackQuestionAttributes 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.common.datatransfer.attributes.FeedbackQuestionAttributes in project teammates by TEAMMATES.
the class InstructorFeedbackResultsPageData method initCommonVariables.
private void initCommonVariables(InstructorAttributes instructor, String selectedSection, String showStats, String groupByTeam, boolean isMissingResponsesShown) {
Assumption.assertNotNull(bundle);
this.instructor = instructor;
this.selectedSection = selectedSection;
this.showStats = showStats;
this.groupByTeam = groupByTeam;
this.isMissingResponsesShown = isMissingResponsesShown;
for (FeedbackQuestionAttributes question : bundle.questions.values()) {
FeedbackQuestionDetails questionDetails = question.getQuestionDetails();
questionToDetailsMap.put(question, questionDetails);
}
this.sections = getSectionsFromBundle();
displayableFsName = sanitizeForHtml(bundle.feedbackSession.getFeedbackSessionName());
displayableCourseId = sanitizeForHtml(bundle.feedbackSession.getCourseId());
}
use of teammates.common.datatransfer.attributes.FeedbackQuestionAttributes in project teammates by TEAMMATES.
the class InstructorSearchPageData method createQuestionTables.
private List<QuestionTable> createQuestionTables(String fsName, FeedbackResponseCommentSearchResultBundle frcSearchResultBundle) {
List<QuestionTable> questionTables = new ArrayList<>();
List<FeedbackQuestionAttributes> questionList = frcSearchResultBundle.questions.get(fsName);
for (FeedbackQuestionAttributes question : questionList) {
int questionNumber = question.questionNumber;
String questionText = question.getQuestionDetails().getQuestionText();
String additionalInfo = question.getQuestionDetails().getQuestionAdditionalInfoHtml(questionNumber, "");
questionTables.add(new QuestionTable(questionNumber, questionText, additionalInfo, createResponseRows(question, frcSearchResultBundle)));
}
return questionTables;
}
use of teammates.common.datatransfer.attributes.FeedbackQuestionAttributes in project teammates by TEAMMATES.
the class InstructorFeedbackQuestionCopyPageData method buildCopyQuestionsModalRows.
private List<FeedbackQuestionTableRow> buildCopyQuestionsModalRows(List<FeedbackQuestionAttributes> copiableQuestions) {
List<FeedbackQuestionTableRow> copyQuestionRows = new ArrayList<>();
for (FeedbackQuestionAttributes question : copiableQuestions) {
String courseId = question.courseId;
String fsName = question.feedbackSessionName;
FeedbackQuestionDetails questionDetails = question.getQuestionDetails();
String qnType = questionDetails.getQuestionTypeDisplayName();
String qnText = questionDetails.getQuestionText();
String qnId = question.getId();
FeedbackQuestionTableRow row = new FeedbackQuestionTableRow(courseId, fsName, qnType, qnText, qnId);
copyQuestionRows.add(row);
}
return copyQuestionRows;
}
Aggregations