Source:
private String getStudentQuestionResultsStatisticsHtml( List<FeedbackResponseAttributes> responses, AccountAttributes currentUser, FeedbackQuestionAttributes question, FeedbackSessionResultsBundle bundle) { String html = ""; double average = 0; double min = Integer.MAX_VALUE; double max = Integer.MIN_VALUE; int numResponses = 0; double total = 0; String currentUserTeam = bundle.emailTeamNameTable.get(currentUser.email); boolean isDirectedAtGeneral = question.recipientType == FeedbackParticipantType.NONE; for(FeedbackResponseAttributes response : responses){ boolean isDirectedAtUser = response.recipientEmail.equals(currentUser.email); boolean isDirectedAtUserTeam = question.recipientType == FeedbackParticipantType.TEAMS && response.recipientEmail.equals(StringHelper.recoverFromSanitizedText(currentUserTeam)); if (isDirectedAtUser || isDirectedAtUserTeam || isDirectedAtGeneral) { numResponses++; double answer = ((FeedbackNumericalScaleResponseDetails)response.getResponseDetails()).getAnswer(); min = (answer < min) ? answer : min; max = (answer > max) ? answer : max; total += answer; } } if (numResponses < 2) { return ""; } average = total/numResponses; DecimalFormat df = new DecimalFormat(); df.setMinimumFractionDigits(0); df.setMaximumFractionDigits(5); df.setRoundingMode(RoundingMode.DOWN); String statsTitle = isDirectedAtGeneral? "Response Summary" : "Summary of responses received by you"; html = FeedbackQuestionFormTemplates.populateTemplate( FeedbackQuestionFormTemplates.NUMSCALE_RESULT_STATS, "${summaryTitle}", statsTitle, "${average}", df.format(average), "${min}", (min == Integer.MAX_VALUE)? "-" : df.format(min), "${max}", (max == Integer.MIN_VALUE)? "-" : df.format(max)); return html; }

Target:
private String getStudentQuestionResultsStatisticsHtml( List<FeedbackResponseAttributes> responses, AccountAttributes currentUser, FeedbackQuestionAttributes question, FeedbackSessionResultsBundle bundle) { String html = ""; double average = 0; double min = Integer.MAX_VALUE; double max = Integer.MIN_VALUE; int numResponses = 0; double total = 0; String currentUserTeam = bundle.emailTeamNameTable.get(currentUser.email); boolean isDirectedAtGeneral = question.recipientType == FeedbackParticipantType.NONE; boolean isDirectedAtTeams = (question.recipientType == FeedbackParticipantType.TEAMS) || (question.recipientType == FeedbackParticipantType.OWN_TEAM); boolean isDirectedAtStudents = !isDirectedAtGeneral && !isDirectedAtTeams; for(FeedbackResponseAttributes response : responses){ boolean isDirectedAtUser = isDirectedAtStudents && response.recipientEmail.equals(currentUser.email); boolean isDirectedAtUserTeam = isDirectedAtTeams && response.recipientEmail.equals(StringHelper.recoverFromSanitizedText(currentUserTeam)); if (isDirectedAtUser || isDirectedAtUserTeam || isDirectedAtGeneral) { numResponses++; double answer = ((FeedbackNumericalScaleResponseDetails)response.getResponseDetails()).getAnswer(); min = Math.min(answer, min); max = Math.max(answer, max); total += answer; } } if (numResponses < 2) { return ""; } average = total/numResponses; DecimalFormat df = new DecimalFormat(); df.setMinimumFractionDigits(0); df.setMaximumFractionDigits(5); df.setRoundingMode(RoundingMode.DOWN); String statsTitle = "Summary of responses received by you"; if (isDirectedAtGeneral) { statsTitle = "Response Summary"; } else if (isDirectedAtTeams) { statsTitle = "Summary of responses received by your team"; } html = FeedbackQuestionFormTemplates.populateTemplate( FeedbackQuestionFormTemplates.NUMSCALE_RESULT_STATS, "${summaryTitle}", statsTitle, "${average}", df.format(average), "${min}", (min == Integer.MAX_VALUE)? "-" : df.format(min), "${max}", (max == Integer.MIN_VALUE)? "-" : df.format(max)); return html; }