add statistic page
[opensuse:software-o-o.git] / lib / tasks / clean_stats.rake
1
2 desc "Remove old download and search stats"
3 task(:clean_stats => :environment) do
4
5   limit_search = DateTime.parse 1.year.ago.to_s
6   limit_download = DateTime.parse 1.year.ago.to_s
7
8   SearchHistory.connection.execute("delete from download_histories where created_at < '#{limit_download}'")
9   SearchHistory.connection.execute("delete from search_histories where created_at < '#{limit_search}'")
10
11 end