<commit_before>class Admin::DashboardController < ApplicationController
  
  def index
    @series = []

    names = ['Sessions', 'Users', 'Points', 'Inclusions', 'Comments']
    [Session, User, Point, Inclusion, Comment].each_with_index do |data, idx|
      dates = {}
      data.all.each do |row|
        split_date = row.created_at.to_s.split(/[- :]/)
        date_key = [split_date[0], split_date[1].to_i-1, split_date[2]]
        dates[date_key] ||= 0
        dates[date_key] += 1           
      end

      time = []
      dates.each do |split_date, val|
        time.push([ "Date.UTC(#{split_date[0]}, #{split_date[1].to_i-1}, #{split_date[2]}, 0, 0, 0)" , val])
      end

      time.sort! {|x,y| x[0] <=> y[0] }
      cumulative = []
      prev = 0
      time.each_with_index do |row, idx|
        cumulative.push([row[0], row[1] + prev])
        prev += row[1]
      end

      yAxisOptions = [<commit_msg>fixing minor date issue with admin dashboard<commit_after>class Admin::DashboardController < ApplicationController
  
  def index
    @series = []

    names = ['Sessions', 'Users', 'Points', 'Inclusions', 'Comments']
    [Session, User, Point, Inclusion, Comment].each_with_index do |data, idx|
      dates = {}
      data.all.each do |row|
        split_date = row.created_at.to_s.split(/[- :]/)
        date_key = [split_date[0], split_date[1].to_i-1, split_date[2]]
        dates[date_key] ||= 0
        dates[date_key] += 1           
      end

      time = []
      dates.each do |split_date, val|
        time.push([ "Date.UTC(#{split_date[0]}, #{split_date[1].to_i}, #{split_date[2]}, 0, 0, 0)" , val])
      end

      time.sort! {|x,y| x[0] <=> y[0] }
      cumulative = []
      prev = 0
      time.each_with_index do |row, idx|
        cumulative.push([row[0], row[1] + prev])
        prev += row[1]
      end

      yAxisOptions = [
{'fraction_non_alphanumeric': 0.16800858829844337, 'fraction_numerical': 0.019860440150295224, 'mean_word_length': 2.4391143911439115, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 5, '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': '1878096', 'n_tokens_mistral': 679, 'n_tokens_neox': 654, 'n_words': 140}