<commit_before>class GetStats
  def call(team_params)
    team = PrepareTeam.new.call(team_params)
    data = fetch_data(team)
    format(data)
  end

  private

  def fetch_data team
    team.team_members.order('team_members.points DESC')
  end

  def format data
    data.map{|tm| "#{tm.slack_user_name}: #{tm.points}"}.join(", ")
  end

end<commit_msg>Implement new format of stats<commit_after>class GetStats
  def call(team_params)
    team = PrepareTeam.new.call(team_params)
    data = fetch_data(team)
    format(data)
  end

  private

  def fetch_data team
    team.team_members
  end

  def format data
    grouped_data = data.group_by(&:points)
    grouped_data.keys
     .sort
     .reverse_each
     .map do |key| 
       members = grouped_data[key].map { |tm| tm.slack_user_name }.join(', ')
       "#{key}: #{members}"
     end.join("\n")
  end

end
{'fraction_non_alphanumeric': 0.11791907514450867, 'fraction_numerical': 0.0, 'mean_word_length': 3.104265402843602, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5416314', 'n_tokens_mistral': 313, 'n_tokens_neox': 307, 'n_words': 65}