Search in sources :

Example 1 with TeamEvalResult

use of teammates.common.datatransfer.TeamEvalResult in project teammates by TEAMMATES.

the class FeedbackContributionQuestionDetails method getQuestionResultStatisticsHtmlStudentView.

private String getQuestionResultStatisticsHtmlStudentView(List<FeedbackResponseAttributes> responses, FeedbackQuestionAttributes question, String studentEmail, FeedbackSessionResultsBundle bundle) {
    if (responses.isEmpty()) {
        return "";
    }
    String currentUserTeam = bundle.emailTeamNameTable.get(studentEmail);
    List<FeedbackResponseAttributes> actualResponses = getActualResponses(question, bundle);
    // List of teams with at least one response
    List<String> teamNames = getTeamsWithAtLeastOneResponse(actualResponses, bundle);
    // Each team's member(email) list
    Map<String, List<String>> teamMembersEmail = getTeamMembersEmail(bundle, teamNames);
    // Each team's responses
    Map<String, List<FeedbackResponseAttributes>> teamResponses = getTeamResponses(actualResponses, bundle, teamNames);
    // Get each team's submission array. -> int[teamSize][teamSize]
    // Where int[0][1] refers points from student 0 to student 1
    // Where student 0 is the 0th student in the list in teamMembersEmail
    Map<String, int[][]> teamSubmissionArray = getTeamSubmissionArray(teamNames, teamMembersEmail, teamResponses);
    // Each team's contribution question results.
    Map<String, TeamEvalResult> teamResults = getTeamResults(teamNames, teamSubmissionArray, teamMembersEmail);
    TeamEvalResult currentUserTeamResults = teamResults.get(currentUserTeam);
    if (currentUserTeamResults == null) {
        return "";
    }
    int currentUserIndex = teamMembersEmail.get(currentUserTeam).indexOf(studentEmail);
    int selfClaim = currentUserTeamResults.claimed[currentUserIndex][currentUserIndex];
    int teamClaim = currentUserTeamResults.denormalizedAveragePerceived[currentUserIndex][currentUserIndex];
    String contribAdditionalInfo = Templates.populateTemplate(FormTemplates.CONTRIB_ADDITIONAL_INFO, Slots.MORE, "[how to interpret, etc..]", Slots.LESS, "[less]", Slots.QUESTION_NUMBER, Integer.toString(question.questionNumber), Slots.ADDITIONAL_INFO_ID, "contributionInfo", Slots.QUESTION_ADDITIONAL_INFO, FormTemplates.CONTRIB_RESULT_STATS_STUDENT_INFO);
    return Templates.populateTemplate(FormTemplates.CONTRIB_RESULT_STATS_STUDENT, Slots.CONTRIB_ADDITIONAL_INFO, contribAdditionalInfo, Slots.CONTRIB_MY_VIEW_OF_ME, getPointsAsColorizedHtml(selfClaim), Slots.CONTRIB_MY_VIEW_OF_OTHERS, getNormalizedPointsListColorizedDescending(currentUserTeamResults.claimed[currentUserIndex], currentUserIndex), Slots.CONTRIB_TEAM_VIEW_OF_ME, getPointsAsColorizedHtml(teamClaim), Slots.CONTRIB_TEAM_VIEW_OF_OTHERS, getNormalizedPointsListColorizedDescending(currentUserTeamResults.denormalizedAveragePerceived[currentUserIndex], currentUserIndex));
}
Also used : FeedbackResponseAttributes(teammates.common.datatransfer.attributes.FeedbackResponseAttributes) TeamEvalResult(teammates.common.datatransfer.TeamEvalResult) ArrayList(java.util.ArrayList) List(java.util.List)

Example 2 with TeamEvalResult

use of teammates.common.datatransfer.TeamEvalResult in project teammates by TEAMMATES.

the class FeedbackContributionQuestionDetails method getTeamResults.

private Map<String, TeamEvalResult> getTeamResults(List<String> teamNames, Map<String, int[][]> teamSubmissionArray, Map<String, List<String>> teamMembersEmail) {
    Map<String, TeamEvalResult> teamResults = new LinkedHashMap<>();
    for (String team : teamNames) {
        TeamEvalResult teamEvalResult = new TeamEvalResult(teamSubmissionArray.get(team));
        teamEvalResult.studentEmails = teamMembersEmail.get(team);
        teamResults.put(team, teamEvalResult);
    }
    return teamResults;
}
Also used : TeamEvalResult(teammates.common.datatransfer.TeamEvalResult) LinkedHashMap(java.util.LinkedHashMap)

Example 3 with TeamEvalResult

use of teammates.common.datatransfer.TeamEvalResult in project teammates by TEAMMATES.

the class FeedbackContributionQuestionDetails method getQuestionResultStatisticsCsv.

@Override
public String getQuestionResultStatisticsCsv(List<FeedbackResponseAttributes> responses, FeedbackQuestionAttributes question, FeedbackSessionResultsBundle bundle) {
    if (responses.isEmpty()) {
        return "";
    }
    List<FeedbackResponseAttributes> actualResponses = getActualResponses(question, bundle);
    // List of teams visible to the instructor and in the selected section
    List<String> teamNames = getTeamNames(bundle);
    // Each team's member(email) list
    Map<String, List<String>> teamMembersEmail = getTeamMembersEmail(bundle, teamNames);
    // Each team's responses
    Map<String, List<FeedbackResponseAttributes>> teamResponses = getTeamResponses(actualResponses, bundle, teamNames);
    // Get each team's submission array. -> int[teamSize][teamSize]
    // Where int[0][1] refers points from student 0 to student 1
    // Where student 0 is the 0th student in the list in teamMembersEmail
    Map<String, int[][]> teamSubmissionArray = getTeamSubmissionArray(teamNames, teamMembersEmail, teamResponses);
    // Each team's eval results.
    Map<String, TeamEvalResult> teamResults = getTeamResults(teamNames, teamSubmissionArray, teamMembersEmail);
    // Each person's results summary
    Map<String, StudentResultSummary> studentResults = getStudentResults(teamMembersEmail, teamResults);
    // Check visibility of recipient
    boolean hideRecipient = false;
    FeedbackParticipantType type = question.recipientType;
    for (FeedbackResponseAttributes response : actualResponses) {
        if (!bundle.visibilityTable.get(response.getId())[1] && type != FeedbackParticipantType.SELF && type != FeedbackParticipantType.NONE) {
            hideRecipient = true;
        }
    }
    StringBuilder contribFragments = new StringBuilder();
    Map<String, String> sortedMap = new LinkedHashMap<>();
    for (Map.Entry<String, StudentResultSummary> entry : studentResults.entrySet()) {
        StudentResultSummary summary = entry.getValue();
        String email = entry.getKey();
        String name = bundle.roster.getStudentForEmail(email).name;
        String team = bundle.roster.getStudentForEmail(email).team;
        List<String> teamEmails = teamMembersEmail.get(team);
        TeamEvalResult teamResult = teamResults.get(team);
        int studentIndx = teamEmails.indexOf(email);
        String displayName;
        String displayTeam;
        String displayEmail;
        if (hideRecipient) {
            displayName = FeedbackSessionResultsBundle.getAnonName(type, name);
            displayTeam = displayName + Const.TEAM_OF_EMAIL_OWNER;
            displayEmail = Const.USER_NOBODY_TEXT;
        } else {
            displayName = name;
            displayTeam = team;
            displayEmail = email;
        }
        int[] incomingPoints = new int[teamResult.normalizedPeerContributionRatio.length];
        for (int i = 0; i < incomingPoints.length; i++) {
            incomingPoints[i] = teamResult.normalizedPeerContributionRatio[i][studentIndx];
        }
        String contribFragmentString = SanitizationHelper.sanitizeForCsv(displayTeam) + "," + SanitizationHelper.sanitizeForCsv(displayName) + "," + SanitizationHelper.sanitizeForCsv(displayEmail) + "," + SanitizationHelper.sanitizeForCsv(Integer.toString(summary.claimedToInstructor)) + "," + SanitizationHelper.sanitizeForCsv(Integer.toString(summary.perceivedToInstructor)) + "," + SanitizationHelper.sanitizeForCsv(getNormalizedPointsListDescending(incomingPoints, studentIndx)) + System.lineSeparator();
        // Replace all Unset values
        contribFragmentString = contribFragmentString.replaceAll(Integer.toString(Const.INT_UNINITIALIZED), "N/A");
        contribFragmentString = contribFragmentString.replaceAll(Integer.toString(Const.POINTS_NOT_SURE), "Not Sure");
        contribFragmentString = contribFragmentString.replaceAll(Integer.toString(Const.POINTS_NOT_SUBMITTED), "Not Submitted");
        // For sorting purposes
        sortedMap.put(displayTeam + "-%-" + displayName, contribFragmentString);
    }
    sortedMap.forEach((key, value) -> contribFragments.append(value));
    String csvPointsExplanation = "In the points given below, an equal share is equal to 100 points. " + "e.g. 80 means \"Equal share - 20%\" and 110 means \"Equal share + 10%\"." + System.lineSeparator() + "Claimed Contribution (CC) = the contribution claimed by the student." + System.lineSeparator() + "Perceived Contribution (PC) = the average value of student's contribution " + "as perceived by the team members." + System.lineSeparator() + "Team, Name, Email, CC, PC, Ratings Recieved" + System.lineSeparator();
    return csvPointsExplanation + contribFragments + System.lineSeparator();
}
Also used : StudentResultSummary(teammates.common.datatransfer.StudentResultSummary) FeedbackParticipantType(teammates.common.datatransfer.FeedbackParticipantType) LinkedHashMap(java.util.LinkedHashMap) FeedbackResponseAttributes(teammates.common.datatransfer.attributes.FeedbackResponseAttributes) TeamEvalResult(teammates.common.datatransfer.TeamEvalResult) ArrayList(java.util.ArrayList) List(java.util.List) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map)

Example 4 with TeamEvalResult

use of teammates.common.datatransfer.TeamEvalResult in project teammates by TEAMMATES.

the class FeedbackContributionQuestionDetails method getQuestionResultsStatisticsHtmlQuestionView.

private String getQuestionResultsStatisticsHtmlQuestionView(List<FeedbackResponseAttributes> responses, FeedbackQuestionAttributes question, FeedbackSessionResultsBundle bundle) {
    if (responses.isEmpty()) {
        return "";
    }
    List<FeedbackResponseAttributes> actualResponses = getActualResponses(question, bundle);
    // List of teams visible to the instructor and in the selected section
    List<String> teamNames = getTeamNames(bundle);
    // Each team's member(email) list
    Map<String, List<String>> teamMembersEmail = getTeamMembersEmail(bundle, teamNames);
    // Each team's responses
    Map<String, List<FeedbackResponseAttributes>> teamResponses = getTeamResponses(actualResponses, bundle, teamNames);
    // Get each team's submission array. -> int[teamSize][teamSize]
    // Where int[0][1] refers points from student 0 to student 1
    // Where student 0 is the 0th student in the list in teamMembersEmail
    Map<String, int[][]> teamSubmissionArray = getTeamSubmissionArray(teamNames, teamMembersEmail, teamResponses);
    // Each team's eval results.
    Map<String, TeamEvalResult> teamResults = getTeamResults(teamNames, teamSubmissionArray, teamMembersEmail);
    // Each person's results summary
    Map<String, StudentResultSummary> studentResults = getStudentResults(teamMembersEmail, teamResults);
    // Check visibility of recipient
    boolean hideRecipient = false;
    FeedbackParticipantType type = question.recipientType;
    for (FeedbackResponseAttributes response : actualResponses) {
        if (!bundle.visibilityTable.get(response.getId())[1] && type != FeedbackParticipantType.SELF && type != FeedbackParticipantType.NONE) {
            hideRecipient = true;
        }
    }
    StringBuilder contribFragments = new StringBuilder();
    for (Map.Entry<String, StudentResultSummary> entry : studentResults.entrySet()) {
        StudentResultSummary summary = entry.getValue();
        String email = entry.getKey();
        String name = bundle.roster.getStudentForEmail(email).name;
        String team = bundle.roster.getStudentForEmail(email).team;
        List<String> teamEmails = teamMembersEmail.get(team);
        TeamEvalResult teamResult = teamResults.get(team);
        int studentIndx = teamEmails.indexOf(email);
        String displayName = name;
        String displayTeam = team;
        if (hideRecipient) {
            displayName = FeedbackSessionResultsBundle.getAnonName(type, name);
            displayTeam = displayName + Const.TEAM_OF_EMAIL_OWNER;
        }
        int[] incomingPoints = new int[teamResult.normalizedPeerContributionRatio.length];
        for (int i = 0; i < incomingPoints.length; i++) {
            incomingPoints[i] = teamResult.normalizedPeerContributionRatio[i][studentIndx];
        }
        contribFragments.append(Templates.populateTemplate(FormTemplates.CONTRIB_RESULT_STATS_FRAGMENT, Slots.CONTRIB_STUDENT_TEAM, SanitizationHelper.sanitizeForHtml(displayTeam), Slots.CONTRIB_STUDENT_NAME, SanitizationHelper.sanitizeForHtml(displayName), Slots.CONTRIB_CC, getPointsAsColorizedHtml(summary.claimedToInstructor), Slots.CONTRIB_PC, getPointsAsColorizedHtml(summary.perceivedToInstructor), Slots.CONTRIB_DIFF, getPointsDiffAsHtml(summary), Slots.CONTRIB_RR, getNormalizedPointsListColorizedDescending(incomingPoints, studentIndx), Slots.CONTRIB_PARAM_STUDENT_NAME, Const.ParamsNames.STUDENT_NAME));
    }
    return Templates.populateTemplate(FormTemplates.CONTRIB_RESULT_STATS, Slots.CONTRIB_FRAGMENTS, contribFragments.toString(), Slots.CONTRIB_TOOLTIPS_CLAIMED, SanitizationHelper.sanitizeForHtml(Const.Tooltips.CLAIMED), Slots.CONTRIB_TOOLTIPS_PERCEIVED, Const.Tooltips.PERCEIVED, Slots.CONTRIB_TOOLTIPS_POINTS_RECEIVED, Const.Tooltips.FEEDBACK_CONTRIBUTION_POINTS_RECEIVED, Slots.CONTRIB_TOOLTIPS_DIFF, Const.Tooltips.FEEDBACK_CONTRIBUTION_DIFF);
}
Also used : StudentResultSummary(teammates.common.datatransfer.StudentResultSummary) FeedbackParticipantType(teammates.common.datatransfer.FeedbackParticipantType) FeedbackResponseAttributes(teammates.common.datatransfer.attributes.FeedbackResponseAttributes) TeamEvalResult(teammates.common.datatransfer.TeamEvalResult) ArrayList(java.util.ArrayList) List(java.util.List) LinkedHashMap(java.util.LinkedHashMap) Map(java.util.Map)

Example 5 with TeamEvalResult

use of teammates.common.datatransfer.TeamEvalResult in project teammates by TEAMMATES.

the class FeedbackContributionResponseDetails method getContributionQuestionResponseAnswerCsv.

private String getContributionQuestionResponseAnswerCsv(FeedbackResponseAttributes response, FeedbackQuestionAttributes question, FeedbackSessionResultsBundle feedbackSessionResultsBundle) {
    Map<String, TeamEvalResult> teamResults = getContribQnTeamEvalResult(question, feedbackSessionResultsBundle);
    Map<String, StudentResultSummary> stats = getContribQnStudentResultSummary(question, feedbackSessionResultsBundle);
    // Need to get actual team name and giver/recipient emails here,
    // only for getting the responseAnswer.
    FeedbackResponseAttributes actualResponse = feedbackSessionResultsBundle.getActualResponse(response);
    String giverTeamName = feedbackSessionResultsBundle.emailTeamNameTable.get(actualResponse.giver);
    TeamEvalResult teamResult = teamResults.get(giverTeamName);
    int giverIndex = teamResult.studentEmails.indexOf(actualResponse.giver);
    int recipientIndex = teamResult.studentEmails.indexOf(actualResponse.recipient);
    String responseAnswerCsv = "";
    if (giverIndex == -1 || recipientIndex == -1) {
        if (giverIndex == -1) {
            log.severe("getContributionQuestionResponseAnswerCsv - giverIndex is -1\n" + "Cannot find giver: " + actualResponse.giver + "\n" + "CourseId: " + feedbackSessionResultsBundle.feedbackSession.getCourseId() + "\n" + "Session Name: " + feedbackSessionResultsBundle.feedbackSession.getFeedbackSessionName() + "\n" + "Response Id: " + actualResponse.getId());
        }
        if (recipientIndex == -1) {
            log.severe("getContributionQuestionResponseAnswerCsv - recipientIndex is -1\n" + "Cannot find recipient: " + actualResponse.recipient + "\n" + "CourseId: " + feedbackSessionResultsBundle.feedbackSession.getCourseId() + "\n" + "Session Name: " + feedbackSessionResultsBundle.feedbackSession.getFeedbackSessionName() + "\n" + "Response Id: " + actualResponse.getId());
        }
    } else {
        responseAnswerCsv = SanitizationHelper.sanitizeForCsv(FeedbackContributionQuestionDetails.convertToEqualShareFormat(teamResult.normalizedPeerContributionRatio[giverIndex][recipientIndex]));
        if (response.giver.equals(response.recipient)) {
            StudentResultSummary studentResult = stats.get(response.giver);
            responseAnswerCsv = SanitizationHelper.sanitizeForCsv(FeedbackContributionQuestionDetails.convertToEqualShareFormat(studentResult.claimedToInstructor));
        }
    }
    return responseAnswerCsv;
}
Also used : FeedbackResponseAttributes(teammates.common.datatransfer.attributes.FeedbackResponseAttributes) TeamEvalResult(teammates.common.datatransfer.TeamEvalResult) StudentResultSummary(teammates.common.datatransfer.StudentResultSummary)

Aggregations

TeamEvalResult (teammates.common.datatransfer.TeamEvalResult)8 FeedbackResponseAttributes (teammates.common.datatransfer.attributes.FeedbackResponseAttributes)5 StudentResultSummary (teammates.common.datatransfer.StudentResultSummary)4 ArrayList (java.util.ArrayList)3 LinkedHashMap (java.util.LinkedHashMap)3 List (java.util.List)3 Map (java.util.Map)2 FeedbackParticipantType (teammates.common.datatransfer.FeedbackParticipantType)2