Search in sources :

Example 1 with InstructorFeedbackResultsSectionPanel

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);
}
Also used : FeedbackResponseAttributes(teammates.common.datatransfer.attributes.FeedbackResponseAttributes) InstructorFeedbackResultsSectionPanel(teammates.ui.template.InstructorFeedbackResultsSectionPanel) InstructorFeedbackResultsParticipantPanel(teammates.ui.template.InstructorFeedbackResultsParticipantPanel) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) HashSet(java.util.HashSet) LinkedHashSet(java.util.LinkedHashSet)

Example 2 with InstructorFeedbackResultsSectionPanel

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);
    }
}
Also used : InstructorFeedbackResultsSectionPanel(teammates.ui.template.InstructorFeedbackResultsSectionPanel)

Example 3 with InstructorFeedbackResultsSectionPanel

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);
}
Also used : LinkedHashSet(java.util.LinkedHashSet) InstructorFeedbackResultsParticipantPanel(teammates.ui.template.InstructorFeedbackResultsParticipantPanel) FeedbackResponseAttributes(teammates.common.datatransfer.attributes.FeedbackResponseAttributes) InstructorFeedbackResultsSectionPanel(teammates.ui.template.InstructorFeedbackResultsSectionPanel) HashMap(java.util.HashMap) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map) HashSet(java.util.HashSet) LinkedHashSet(java.util.LinkedHashSet)

Example 4 with InstructorFeedbackResultsSectionPanel

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);
}
Also used : InstructorFeedbackResultsSectionPanel(teammates.ui.template.InstructorFeedbackResultsSectionPanel)

Aggregations

InstructorFeedbackResultsSectionPanel (teammates.ui.template.InstructorFeedbackResultsSectionPanel)4 HashMap (java.util.HashMap)2 HashSet (java.util.HashSet)2 LinkedHashMap (java.util.LinkedHashMap)2 LinkedHashSet (java.util.LinkedHashSet)2 Map (java.util.Map)2 FeedbackResponseAttributes (teammates.common.datatransfer.attributes.FeedbackResponseAttributes)2 InstructorFeedbackResultsParticipantPanel (teammates.ui.template.InstructorFeedbackResultsParticipantPanel)2