Source:
<code>public String getQuestionResultStatisticsCsv( List<FeedbackResponseAttributes> responses, FeedbackQuestionAttributes question, FeedbackSessionResultsBundle bundle) { if (responses.isEmpty()) { return ""; } StringBuilder fragments = new StringBuilder(); Map<String, List<Integer>> recipientRanks = generateOptionRanksMapping(responses); Map<String, List<Integer>> recipientRanksExcludingSelf = getRecipientRanksExcludingSelf(responses, question); DecimalFormat df = new DecimalFormat("#.##"); for (Entry<String, List<Integer>> entry : recipientRanks.entrySet()) { String teamName = bundle.getTeamNameForEmail(entry.getKey()); String recipientName = bundle.getNameForEmail(entry.getKey()); String option = SanitizationHelper.sanitizeForCsv(teamName) + "," + SanitizationHelper.sanitizeForCsv(recipientName); String userAverageExcludingSelfText = getAverageExcludingSelfText(df, recipientRanksExcludingSelf, entry.getKey()); List<Integer> ranks = entry.getValue(); double average = computeAverage(ranks); fragments.append(option).append(',').append(df.format(average)); if (shouldSelfBeExcludedFromRankings(question)) { fragments.append(',').append(userAverageExcludingSelfText); } fragments.append(','); <START> fragments.append(StringHelper.join(",", ranks)); <END> fragments.append(Const.EOL); } String rankQuestionHeaderSelf = shouldSelfBeExcludedFromRankings(question) ? ", Average Rank Excluding Self" : ""; return "Team, Recipient, Average Rank" + rankQuestionHeaderSelf + ", Ranks Received" + Const.EOL + fragments + Const.EOL; }</code><technical_language>Please SanitizationHelper.sanitizeForCsv() too</technical_language>

Target:
public String getQuestionResultStatisticsCsv( List<FeedbackResponseAttributes> responses, FeedbackQuestionAttributes question, FeedbackSessionResultsBundle bundle) { if (responses.isEmpty()) { return ""; } StringBuilder fragments = new StringBuilder(); Map<String, List<Integer>> recipientRanks = generateOptionRanksMapping(responses); Map<String, List<Integer>> recipientRanksExcludingSelf = getRecipientRanksExcludingSelf(responses, question); DecimalFormat df = new DecimalFormat("#.##"); Map<String, Integer> recipientSelfRanks = new HashMap<>(); if (shouldSelfBeExcludedFromRankings(question)) { recipientSelfRanks = generateSelfRankForEachRecipient(responses); } for (Entry<String, List<Integer>> entry : recipientRanks.entrySet()) { String teamName = bundle.getTeamNameForEmail(entry.getKey()); String recipientName = bundle.getNameForEmail(entry.getKey()); String option = SanitizationHelper.sanitizeForCsv(teamName) + "," + SanitizationHelper.sanitizeForCsv(recipientName); String userAverageExcludingSelfText = getAverageExcludingSelfText(df, recipientRanksExcludingSelf, entry.getKey()); List<Integer> ranks = entry.getValue(); double average = computeAverage(ranks); String selfRank = recipientSelfRanks.containsKey(entry.getKey()) ? Integer.toString(recipientSelfRanks.get(entry.getKey())) : "-"; fragments.append(option); fragments.append(',').append(selfRank); fragments.append(',').append(df.format(average)); if (shouldSelfBeExcludedFromRankings(question)) { fragments.append(',').append(userAverageExcludingSelfText); } fragments.append(','); fragments.append(StringHelper.join(",", ranks)); fragments.append(Const.EOL); } String rankQuestionHeaderSelf = shouldSelfBeExcludedFromRankings(question) ? ", Average Rank Excluding Self" : ""; return "Team, Recipient, Self Rank, Average Rank" + rankQuestionHeaderSelf + ", Ranks Received" + Const.EOL + fragments + Const.EOL; }