use of teammates.ui.template.InstructorFeedbackResultsSectionPanel 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.InstructorFeedbackResultsSectionPanel in project teammates by TEAMMATES.
the class InstructorFeedbackResultsPageData method buildSectionPanelsForForAjaxLoading.
private void buildSectionPanelsForForAjaxLoading(List<String> sections) {
sectionPanels = new LinkedHashMap<>();
InstructorFeedbackResultsSectionPanel sectionPanel = new InstructorFeedbackResultsSectionPanel(Const.DEFAULT_SECTION, Const.NO_SPECIFIC_SECTION, true);
sectionPanels.put(Const.DEFAULT_SECTION, sectionPanel);
for (String section : sections) {
sectionPanel = new InstructorFeedbackResultsSectionPanel(section, section, true);
sectionPanels.put(section, sectionPanel);
}
}
use of teammates.ui.template.InstructorFeedbackResultsSectionPanel 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.InstructorFeedbackResultsSectionPanel in project teammates by TEAMMATES.
the class InstructorFeedbackResultsPageData method buildSectionPanelWithErrorMessage.
private void buildSectionPanelWithErrorMessage() {
sectionPanels = new LinkedHashMap<>();
InstructorFeedbackResultsSectionPanel sectionPanel = new InstructorFeedbackResultsSectionPanel();
sectionPanel.setSectionName(selectedSection);
sectionPanel.setSectionNameForDisplay(selectedSection);
sectionPanel.setAbleToLoadResponses(false);
sectionPanels.put(selectedSection, sectionPanel);
}
Aggregations