use of teammates.ui.template.InstructorFeedbackResultsParticipantPanel in project teammates by TEAMMATES.
the class InstructorFeedbackResultsPageData method buildSectionPanelForViewByParticipantParticipantQuestion.
private void buildSectionPanelForViewByParticipantParticipantQuestion(String section, Map<String, Map<String, List<FeedbackResponseAttributes>>> sortedResponses, String additionalInfoId) {
sectionPanels = new LinkedHashMap<>();
InstructorFeedbackResultsSectionPanel sectionPanel = new InstructorFeedbackResultsSectionPanel();
String prevTeam = "";
String sectionPrefix = String.format("section-%s-", getSectionPosition(section));
Set<String> teamsWithResponses = new HashSet<>();
Set<String> teamMembersWithResponses = new HashSet<>();
// Iterate through the primary participant
int primaryParticipantIndex = this.getStartIndex();
for (Entry<String, Map<String, List<FeedbackResponseAttributes>>> primaryToSecondaryParticipantToResponsesMap : sortedResponses.entrySet()) {
primaryParticipantIndex += 1;
String primaryParticipantIdentifier = primaryToSecondaryParticipantToResponsesMap.getKey();
String currentTeam = getCurrentTeam(bundle, primaryParticipantIdentifier);
boolean isStudent = bundle.isParticipantIdentifierStudent(primaryParticipantIdentifier);
String participantSection = bundle.getSectionFromRoster(primaryParticipantIdentifier);
if (isStudent && !participantSection.equals(section)) {
continue;
}
boolean isDifferentTeam = !prevTeam.equals(currentTeam);
if (isDifferentTeam) {
boolean isFirstTeam = prevTeam.isEmpty();
if (!isFirstTeam) {
// construct missing participant panels for the previous team
buildMissingParticipantPanelsForTeam(sectionPanel, prevTeam, teamMembersWithResponses);
teamMembersWithResponses.clear();
}
teamsWithResponses.add(currentTeam);
sectionPanel.getIsTeamWithResponses().put(currentTeam, true);
}
// Build participant panel for the current primary participant
InstructorFeedbackResultsParticipantPanel recipientPanel = buildGroupByParticipantPanel(primaryParticipantIdentifier, primaryToSecondaryParticipantToResponsesMap, sectionPrefix + additionalInfoId, primaryParticipantIndex);
sectionPanel.addParticipantPanel(currentTeam, recipientPanel);
teamMembersWithResponses.add(primaryParticipantIdentifier);
prevTeam = currentTeam;
}
// for the last section with responses
buildMissingParticipantPanelsForTeam(sectionPanel, prevTeam, teamMembersWithResponses);
teamsWithResponses.add(prevTeam);
buildMissingTeamAndParticipantPanelsForSection(sectionPanel, section, teamsWithResponses);
finalizeBuildingSectionPanelWithoutTeamStats(sectionPanel, section);
sectionPanels.put(section, sectionPanel);
}
use of teammates.ui.template.InstructorFeedbackResultsParticipantPanel in project teammates by TEAMMATES.
the class InstructorFeedbackResultsPageData method buildSectionPanelForViewByParticipantQuestionParticipant.
/**
* Constructs section panel for the {@code sortedResponses}.
*
* <p>Also builds team statistics tables for every team.
*/
private void buildSectionPanelForViewByParticipantQuestionParticipant(String section, Map<String, Map<FeedbackQuestionAttributes, List<FeedbackResponseAttributes>>> sortedResponses, String additionalInfoId) {
sectionPanels = new LinkedHashMap<>();
Map<String, Map<FeedbackQuestionAttributes, List<FeedbackResponseAttributes>>> responsesGroupedByTeam = viewType.isPrimaryGroupingOfGiverType() ? bundle.getQuestionResponseMapByGiverTeam() : bundle.getQuestionResponseMapByRecipientTeam();
String prevTeam = "";
String sectionPrefix = String.format("section-%s-", getSectionPosition(section));
Set<String> teamsWithResponses = new LinkedHashSet<>();
Set<String> teamMembersWithResponses = new HashSet<>();
InstructorFeedbackResultsSectionPanel sectionPanel = new InstructorFeedbackResultsSectionPanel();
// Iterate through the primary participant
int primaryParticipantIndex = this.getStartIndex();
for (Entry<String, Map<FeedbackQuestionAttributes, List<FeedbackResponseAttributes>>> primaryToSecondaryParticipantToResponsesMap : sortedResponses.entrySet()) {
primaryParticipantIndex += 1;
String primaryParticipantIdentifier = primaryToSecondaryParticipantToResponsesMap.getKey();
boolean isStudent = bundle.isParticipantIdentifierStudent(primaryParticipantIdentifier);
String participantSection = bundle.getSectionFromRoster(primaryParticipantIdentifier);
if (isStudent && !participantSection.equals(section)) {
continue;
}
String currentTeam = getCurrentTeam(bundle, primaryParticipantIdentifier);
boolean isDifferentTeam = !prevTeam.equals(currentTeam);
if (isDifferentTeam) {
boolean isFirstTeam = prevTeam.isEmpty();
if (!isFirstTeam) {
// construct missing participant panels for the previous team
buildMissingParticipantPanelsForTeam(sectionPanel, prevTeam, teamMembersWithResponses);
teamMembersWithResponses.clear();
}
teamsWithResponses.add(currentTeam);
sectionPanel.getIsTeamWithResponses().put(currentTeam, true);
}
// Build participant panel for the current participant
InstructorFeedbackResultsParticipantPanel primaryParticipantPanel = buildGroupByQuestionPanel(primaryParticipantIdentifier, primaryToSecondaryParticipantToResponsesMap, sectionPrefix + additionalInfoId, primaryParticipantIndex);
sectionPanel.addParticipantPanel(currentTeam, primaryParticipantPanel);
teamMembersWithResponses.add(primaryParticipantIdentifier);
prevTeam = currentTeam;
}
// for the last section with responses
buildMissingParticipantPanelsForTeam(sectionPanel, prevTeam, teamMembersWithResponses);
teamsWithResponses.add(prevTeam);
buildMissingTeamAndParticipantPanelsForSection(sectionPanel, section, teamsWithResponses);
finalizeBuildingSectionPanel(sectionPanel, section, responsesGroupedByTeam, teamsWithResponses);
sectionPanels.put(section, sectionPanel);
}
use of teammates.ui.template.InstructorFeedbackResultsParticipantPanel in project teammates by TEAMMATES.
the class InstructorFeedbackResultsPageData method addMissingParticipantsPanelsWithoutModerationButtonForTeam.
private void addMissingParticipantsPanelsWithoutModerationButtonForTeam(InstructorFeedbackResultsSectionPanel sectionPanel, String teamName, List<String> teamMembers) {
for (String teamMember : teamMembers) {
InstructorFeedbackResultsParticipantPanel giverPanel;
if (viewType.isSecondaryGroupingOfParticipantType()) {
String teamMemberWithTeamNameAppended = bundle.getFullNameFromRoster(teamMember) + " (" + bundle.getTeamNameFromRoster(teamMember) + ")";
giverPanel = buildInstructorFeedbackResultsGroupBySecondaryParticipantPanel(teamMember, teamMemberWithTeamNameAppended, new ArrayList<InstructorFeedbackResultsSecondaryParticipantPanelBody>(), null);
} else {
giverPanel = new InstructorFeedbackResultsGroupByQuestionPanel(new ArrayList<InstructorFeedbackResultsQuestionTable>(), getStudentProfilePictureLink(teamMember, instructor.courseId), viewType.isPrimaryGroupingOfGiverType(), teamMember, bundle.getFullNameFromRoster(teamMember));
}
giverPanel.setHasResponses(false);
sectionPanel.addParticipantPanel(teamName, giverPanel);
}
}
use of teammates.ui.template.InstructorFeedbackResultsParticipantPanel in project teammates by TEAMMATES.
the class InstructorFeedbackResultsPageData method addMissingParticipantsPanelsWithModerationButtonForTeam.
/**
* Builds participant panels for the specified team, and add to sectionPanel.
*/
private void addMissingParticipantsPanelsWithModerationButtonForTeam(InstructorFeedbackResultsSectionPanel sectionPanel, String teamName, List<String> teamMembers) {
for (String teamMember : teamMembers) {
InstructorFeedbackResultsModerationButton moderationButton = buildModerationButtonForGiver(null, teamMember, "btn btn-default btn-xs", MODERATE_RESPONSES_FOR_GIVER);
InstructorFeedbackResultsParticipantPanel giverPanel;
if (viewType.isSecondaryGroupingOfParticipantType()) {
String teamMemberNameWithTeamNameAppended = bundle.getFullNameFromRoster(teamMember) + " (" + bundle.getTeamNameFromRoster(teamMember) + ")";
giverPanel = buildInstructorFeedbackResultsGroupBySecondaryParticipantPanel(teamMember, teamMemberNameWithTeamNameAppended, new ArrayList<InstructorFeedbackResultsSecondaryParticipantPanelBody>(), moderationButton);
} else {
giverPanel = new InstructorFeedbackResultsGroupByQuestionPanel(teamMember, bundle.getFullNameFromRoster(teamMember), new ArrayList<InstructorFeedbackResultsQuestionTable>(), getStudentProfilePictureLink(teamMember, instructor.courseId), viewType.isPrimaryGroupingOfGiverType(), moderationButton);
}
giverPanel.setHasResponses(false);
sectionPanel.addParticipantPanel(teamName, giverPanel);
}
}
Aggregations