scinote-web/lib/tasks/exportable_items.rake
Urban Rotnik 247bae8a9f Refactor export_all_counter increasing/reseting logic
- Remove daily task
- Add method to user Model
2019-01-25 11:16:31 +01:00

11 lines
355 B
Ruby

# frozen_string_literal: true
namespace :exportable_items do
desc 'Removes exportable zip files'
task cleanup: :environment do
num = Constants::EXPORTABLE_ZIP_EXPIRATION_DAYS
ZipExport.where('created_at < ?', num.days.ago).destroy_all
puts "All exportable zip files older than " \
"'#{num.days.ago}' have been removed"
end
end