<commit_before>class Admin::IndexController < Admin::AdminController

  def index
    @pagename = "Administration"
    @num_users = User.count
    @num_elec_readings = ElectricityReading.count 
    @num_elec_accounts = ElectricityAccount.count 
    @num_gas_readings = GasReading.count 
    @num_gas_accounts = GasAccount.count 
    @num_vehicle_fuel_purchases = VehicleFuelPurchase.count 
    @num_vehicles = Vehicle.count 
    @num_flights = Flight.count 
    @num_sessions = CGI::Session::ActiveRecordStore::Session::count
    @num_old_sessions = CGI::Session::ActiveRecordStore::Session::count(:conditions => ["updated_at < ?", 1.month.ago.to_s(:db)])
    @data_file = url_for :action => "chart"
  end

  def clean_sessions
    CGI::Session::ActiveRecordStore::Session::destroy_all(["updated_at < ?", 1.month.ago.to_s(:db)])
    redirect_to :action => "index"
  end
  
  def clearcacheddata
    User.find(:all).each do |user| 
      user.annual_emission_total = nil
      user.save! unless user.login.empty?
    end
    redirect_to :action => "index" 
  end
  
  def chart
    @data = User.find(:all,
                      :select => "COUNT(*) AS count, date(`created_at`) as date",
                      :conditions => ["created_at > ?", 3.months.ago.to_date],
                      :order => "date",
                      :group => "date")
    render :action => 'chart.rxml', :layout => false
  end

end<commit_msg>fix session sweeping<commit_after>class Admin::IndexController < Admin::AdminController

  def index
    @pagename = "Administration"
    @num_users = User.count
    @num_elec_readings = ElectricityReading.count 
    @num_elec_accounts = ElectricityAccount.count 
    @num_gas_readings = GasReading.count 
    @num_gas_accounts = GasAccount.count 
    @num_vehicle_fuel_purchases = VehicleFuelPurchase.count 
    @num_vehicles = Vehicle.count 
    @num_flights = Flight.count 
    @num_sessions = ActiveRecord::SessionStore::Session::count
    @num_old_sessions = ActiveRecord::SessionStore::Session::count(:conditions => ["updated_at < ?", 1.month.ago.to_s(:db)])
    @data_file = url_for :action => "chart"
  end

  def clean_sessions
    ActiveRecord::SessionStore::Session::destroy_all(["updated_at < ?", 1.month.ago.to_s(:db)])
    redirect_to :action => "index"
  end
  
  def clearcacheddata
    User.find(:all).each do |user| 
      user.annual_emission_total = nil
      user.save! unless user.login.empty?
    end
    redirect_to :action => "index" 
  end
  
  def chart
    @data = User.find(:all,
                      :select => "COUNT(*) AS count, date(`created_at`) as date",
                      :conditions => ["created_at > ?", 3.months.ago.to_date],
                      :order => "date",
                      :group => "date")
    render :action => 'chart.rxml', :layout => false
  end

end
{'fraction_non_alphanumeric': 0.1277346506704305, 'fraction_numerical': 0.002117148906139732, 'mean_word_length': 3.067431850789096, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 2}, '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': '5551202', 'n_tokens_mistral': 943, 'n_tokens_neox': 887, 'n_words': 165}