12_generate_custom_csv_file #58
3 changed files with 19 additions and 2 deletions
|
@ -173,6 +173,9 @@ default: &defaults
|
||||||
# default to allow automatically adding new articles on sync only when less than 200 articles in total
|
# default to allow automatically adding new articles on sync only when less than 200 articles in total
|
||||||
#shared_supplier_article_sync_limit: 200
|
#shared_supplier_article_sync_limit: 200
|
||||||
|
|
||||||
|
# number of days after which attachment files get deleted
|
||||||
|
#attachment_retention_days: 365
|
||||||
|
|
||||||
development:
|
development:
|
||||||
<<: *defaults
|
<<: *defaults
|
||||||
|
|
||||||
|
|
|
@ -12,9 +12,10 @@ every :weekday, at: %w[5:56am 6:04pm] do
|
||||||
rake 'multicoops:run TASK=foodsoft:import_and_assign_bank_transactions'
|
rake 'multicoops:run TASK=foodsoft:import_and_assign_bank_transactions'
|
||||||
end
|
end
|
||||||
|
|
||||||
# Weekly taks
|
# Weekly tasks
|
||||||
every :sunday, at: '7:14 am' do
|
every :sunday, at: '7:14 am' do
|
||||||
rake 'multicoops:run TASK=foodsoft:create_upcoming_periodic_tasks'
|
rake 'multicoops:run TASK=foodsoft:create_upcoming_periodic_tasks'
|
||||||
|
rake 'multicoops:run TASKS=foodsoft:prune_old_attachments'
|
||||||
end
|
end
|
||||||
|
|
||||||
# Finish ended orders
|
# Finish ended orders
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
# put in here all foodsoft tasks
|
# put in here all foodsoft tasks
|
||||||
# => :environment loads the environment an gives easy access to the application
|
# => :environment loads the environment an gives easy access to the application
|
||||||
namespace :foodsoft do
|
namespace :foodsoft do # rubocop:disable Metrics/BlockLength
|
||||||
desc 'Finish ended orders'
|
desc 'Finish ended orders'
|
||||||
task finish_ended_orders: :environment do
|
task finish_ended_orders: :environment do
|
||||||
Order.finish_ended!
|
Order.finish_ended!
|
||||||
|
@ -79,6 +79,19 @@ namespace :foodsoft do
|
||||||
rake_say "#{ba.name}: imported #{importer.count}, assigned #{assign_count}"
|
rake_say "#{ba.name}: imported #{importer.count}, assigned #{assign_count}"
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
desc 'Prune attachments older than maximum age'
|
||||||
|
task prune_old_attachments: :environment do
|
||||||
|
if FoodsoftConfig[:attachment_retention_days]
|
||||||
|
rake_say "Pruning attachments older than #{FoodsoftConfig[:attachment_retention_days]} days"
|
||||||
|
ActiveStorage::Attachment.where("created_at < ?", FoodsoftConfig[:attachment_retention_days].days.ago).each do |attachment|
|
||||||
|
rake_say attachment.inspect
|
||||||
|
attachment.purge_later
|
||||||
|
end
|
||||||
|
else
|
||||||
|
rake_say "Please configure your app_config.yml accordingly:\nattachment_retention_days: <number of days>"
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
# Helper
|
# Helper
|
||||||
|
|
Loading…
Reference in a new issue