From 4cebaee4db3eef24d5d5e7e51b2aae6b057d9aa6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jonne=20Ha=C3=9F?= Date: Sat, 22 Sep 2012 13:25:03 +0200 Subject: [PATCH] Remove stats.rake, if you really use it revert this commit and fix it --- lib/tasks/stats.rake | 40 ---------------------------------------- 1 file changed, 40 deletions(-) delete mode 100644 lib/tasks/stats.rake diff --git a/lib/tasks/stats.rake b/lib/tasks/stats.rake deleted file mode 100644 index 506b35484..000000000 --- a/lib/tasks/stats.rake +++ /dev/null @@ -1,40 +0,0 @@ -require Rails.root.join('lib', 'statistics' ) - -namespace :stats do - desc 'Emails recent engagement statistics the admins' - task :save_retention => :environment do - require Rails.root.join('app', 'mailers', 'notifier' ) - - return unless AppConfig[:admins].present? - - admins = User.find_all_by_username( AppConfig[:admins]) - - require 'fastercsv' - - string = FasterCSV.generate do |csv| - (0..32).each do |i| - csv << [i.to_s, Statistics.new.retention(i)] - end - end - - File.open(Rails.root.join("tmp", "retention_stats_#{Time.now.strftime("%Y-%m-%d-%H:%M:%S-%Z")}.txt"), "w") do |file| - file << string - end - end - - task :top_actives => :environment do - - require 'fastercsv' - - string = FasterCSV.generate do |csv| - (0..32).each do |i| - actives = ActiveRecord::Base.connection.select_all(Statistics.new.top_active_users(i).to_sql) - actives.each do |a| - csv << [i.to_s, a['email'], a['username'], a['first_name'], a['sign_in_count']] - end - end - end - - File.open(Rails.root.join('tmp', 'top_actives.csv'), 'w') {|f| f.write(string) } - end -end