<commit_before>class Admin::Api::StatsController < Admin::Api::BaseController

  def show
    unless params[:events].present? || 
           params[:visits].present? || 
           params[:spending_proposals].present?
      return render json: {}, status: :bad_request
    end

    ds = Ahoy::DataSource.new

    if params[:events].present?
      event_types = params[:events].split ','
      event_types.each do |event|
        ds.add event.titleize, Ahoy::Event.where(name: event).group_by_day(:time).count
      end
    end

    if params[:visits].present?
      ds.add "Visits", Visit.group_by_day(:started_at).count
    end

    if params[:spending_proposals].present?
      ds.add "Spending proposals", SpendingProposal.group_by_day(:created_at).count
    end

    render json: ds.build
  end
end<commit_msg>removes unused multiple lines per graph<commit_after>class Admin::Api::StatsController < Admin::Api::BaseController

  def show
    unless params[:event].present? ||
           params[:visits].present? ||
           params[:spending_proposals].present?
      return render json: {}, status: :bad_request
    end

    ds = Ahoy::DataSource.new

    if params[:event].present?
      ds.add params[:event].titleize, Ahoy::Event.where(name: params[:event]).group_by_day(:time).count
    end

    if params[:visits].present?
      ds.add "Visits", Visit.group_by_day(:started_at).count
    end

    if params[:spending_proposals].present?
      ds.add "Spending proposals", SpendingProposal.group_by_day(:created_at).count
    end
    render json: ds.build
  end
end
{'fraction_non_alphanumeric': 0.12507936507936507, 'fraction_numerical': 0.0, 'mean_word_length': 3.3899721448467965, 'pattern_counts': {'":': 0, '<': 5, '<?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': '7240068', 'n_tokens_mistral': 489, 'n_tokens_neox': 473, 'n_words': 94}