Search in sources :

Example 1 with InstructorFeedbackResultsParticipantPanel

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);
}
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 InstructorFeedbackResultsParticipantPanel

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);
}
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 3 with InstructorFeedbackResultsParticipantPanel

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);
    }
}
Also used : InstructorFeedbackResultsGroupByQuestionPanel(teammates.ui.template.InstructorFeedbackResultsGroupByQuestionPanel) ArrayList(java.util.ArrayList) InstructorFeedbackResultsParticipantPanel(teammates.ui.template.InstructorFeedbackResultsParticipantPanel)

Example 4 with InstructorFeedbackResultsParticipantPanel

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);
    }
}
Also used : InstructorFeedbackResultsGroupByQuestionPanel(teammates.ui.template.InstructorFeedbackResultsGroupByQuestionPanel) ArrayList(java.util.ArrayList) InstructorFeedbackResultsParticipantPanel(teammates.ui.template.InstructorFeedbackResultsParticipantPanel) InstructorFeedbackResultsModerationButton(teammates.ui.template.InstructorFeedbackResultsModerationButton)

Aggregations

InstructorFeedbackResultsParticipantPanel (teammates.ui.template.InstructorFeedbackResultsParticipantPanel)4 ArrayList (java.util.ArrayList)2 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 InstructorFeedbackResultsGroupByQuestionPanel (teammates.ui.template.InstructorFeedbackResultsGroupByQuestionPanel)2 InstructorFeedbackResultsSectionPanel (teammates.ui.template.InstructorFeedbackResultsSectionPanel)2 InstructorFeedbackResultsModerationButton (teammates.ui.template.InstructorFeedbackResultsModerationButton)1