<commit_before>module HomeHelper
  
  def featured_groups
    @featured_groups =  Group.where(is_featured: true)
  end

  def featured_groups_size
    @size = @featured_groups.size
  end

  def widget_class
    if @size > 2
      "col-md-4"
    elsif @size == 2
      "col-md-6"
    else
      "col-md-12"
    end
  end

  def multi_line_chart
   
    users = Subscription.collection.aggregate( [  { "$group" => { _id: "$round_id", total: { "$sum" => 1 } } } ] ).sort {|x, y| Date.parse(Round.find(y["_id"]).name) <=> Date.parse(Round.find(x["_id"]).name) }.collect { |r| [ Round.find(r["_id"]).name, r["total"] ] }[0..5].reverse

    contributions = Subscription.collection.aggregate( [ {"$match" => { "created_at" => { "$gt" => Date.parse("march 2016") } } }, { "$group" => { _id: "$round_id", total: { "$sum" => "$points" } } } ]).sort {|x, y| Date.parse(Round.find(y["_id"]).name) <=> Date.parse(Round.find(x["_id"]).name) }.collect { |r| [ Round.find(r["_id"]).name, r["total"] ] }[0..5].reverse

    @user_trend = []
    @contribution_trend = []
    @user_xAxis = []
    @xAxis = []
    
    users.map{ |user| @user_trend << user[1]; @user_xAxis << user[0]}
    
    contributions.map{ |contribution| @contribution_trend << contribution[1]; @xAxis << contribution[0]}
    

 end

end<commit_msg>ref #51 modified the home page chart<commit_after>module HomeHelper
  
  def featured_groups
    @featured_groups =  Group.where(is_featured: true)
  end

  def featured_groups_size
    @size = @featured_groups.size
  end

  def widget_class
    if @size > 2
      "col-md-4"
    elsif @size == 2
      "col-md-6"
    else
      "col-md-12"
    end
  end

  def multi_line_chart
   
    users = Subscription.collection.aggregate( [  { "$group" => { _id: "$round_id", total: { "$sum" => 1 } } } ] ).sort {|x, y| Date.parse(Round.find(y["_id"]).name) <=> Date.parse(Round.find(x["_id"]).name) }.collect { |r| [ Round.find(r["_id"]).name, r["total"] ] }[1..6].reverse

    contributions = Subscription.collection.aggregate( [ {"$match" => { "created_at" => { "$gt" => Date.parse("march 2016") } } }, { "$group" => { _id: "$round_id", total: { "$sum" => "$points" } } } ]).sort {|x, y| Date.parse(Round.find(y["_id"]).name) <=> Date.parse(Round.find(x["_id"]).name) }.collect { |r| [ Round.find(r["_id"]).name, r["total"] ] }[1..6].reverse

    @user_trend = []
    @contribution_trend = []
    @user_xAxis = []
    @xAxis = []
    
    users.map{ |user| @user_trend << user[1]; @user_xAxis << user[0]}
    
    contributions.map{ |contribution| @contribution_trend << contribution[1]; @xAxis << contribution[0]}
    

 end

end
{'fraction_non_alphanumeric': 0.21142857142857144, 'fraction_numerical': 0.015238095238095238, 'mean_word_length': 3.3119868637110015, 'pattern_counts': {'":': 0, '<': 23, '<?xml version=': 0, '>': 23, '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': '5493722', 'n_tokens_mistral': 1033, 'n_tokens_neox': 997, 'n_words': 181}