chore: rubocop
chore: fix api test conventions chore: rubocop -A spec/ chore: more rubocop -A fix failing test rubocop fixes removes helper methods that are in my opinion dead code more rubocop fixes rubocop -a --auto-gen-config
This commit is contained in:
parent
f6fb804bbe
commit
fb2b4d8a8a
331 changed files with 4263 additions and 4507 deletions
|
|
@ -1,61 +1,61 @@
|
|||
# put in here all foodsoft tasks
|
||||
# => :environment loads the environment an gives easy access to the application
|
||||
namespace :foodsoft do
|
||||
desc "Finish ended orders"
|
||||
task :finish_ended_orders => :environment do
|
||||
desc 'Finish ended orders'
|
||||
task finish_ended_orders: :environment do
|
||||
Order.finish_ended!
|
||||
end
|
||||
|
||||
desc "Notify users of upcoming tasks"
|
||||
task :notify_upcoming_tasks => :environment do
|
||||
desc 'Notify users of upcoming tasks'
|
||||
task notify_upcoming_tasks: :environment do
|
||||
tasks = Task.where(done: false, due_date: 1.day.from_now.to_date)
|
||||
for task in tasks
|
||||
rake_say "Send notifications for #{task.name} to .."
|
||||
for user in task.users
|
||||
if user.settings.notify['upcoming_tasks']
|
||||
Mailer.deliver_now_with_user_locale user do
|
||||
Mailer.upcoming_tasks(user, task)
|
||||
end
|
||||
next unless user.settings.notify['upcoming_tasks']
|
||||
|
||||
Mailer.deliver_now_with_user_locale user do
|
||||
Mailer.upcoming_tasks(user, task)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
desc "Notify workgroup of upcoming weekly task"
|
||||
task :notify_users_of_weekly_task => :environment do
|
||||
tasks = Task.where(done: false, due_date: 7.day.from_now.to_date)
|
||||
desc 'Notify workgroup of upcoming weekly task'
|
||||
task notify_users_of_weekly_task: :environment do
|
||||
tasks = Task.where(done: false, due_date: 7.days.from_now.to_date)
|
||||
for task in tasks
|
||||
unless task.enough_users_assigned?
|
||||
workgroup = task.workgroup
|
||||
if workgroup
|
||||
rake_say "Notify workgroup: #{workgroup.name} for task #{task.name}"
|
||||
for user in workgroup.users
|
||||
if user.receive_email?
|
||||
Mailer.deliver_now_with_user_locale user do
|
||||
Mailer.not_enough_users_assigned(task, user)
|
||||
end
|
||||
end
|
||||
end
|
||||
next if task.enough_users_assigned?
|
||||
|
||||
workgroup = task.workgroup
|
||||
next unless workgroup
|
||||
|
||||
rake_say "Notify workgroup: #{workgroup.name} for task #{task.name}"
|
||||
for user in workgroup.users
|
||||
next unless user.receive_email?
|
||||
|
||||
Mailer.deliver_now_with_user_locale user do
|
||||
Mailer.not_enough_users_assigned(task, user)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
desc "Create upcoming periodic tasks"
|
||||
task :create_upcoming_periodic_tasks => :environment do
|
||||
desc 'Create upcoming periodic tasks'
|
||||
task create_upcoming_periodic_tasks: :environment do
|
||||
for tg in PeriodicTaskGroup.all
|
||||
created_until = tg.create_tasks_for_upfront_days
|
||||
rake_say "created until #{created_until}"
|
||||
end
|
||||
end
|
||||
|
||||
desc "Parse incoming email on stdin (options: RECIPIENT=foodcoop.handling)"
|
||||
task :parse_reply_email => :environment do
|
||||
desc 'Parse incoming email on stdin (options: RECIPIENT=foodcoop.handling)'
|
||||
task parse_reply_email: :environment do
|
||||
FoodsoftMailReceiver.received ENV.fetch('RECIPIENT', nil), STDIN.read
|
||||
end
|
||||
|
||||
desc "Start STMP server for incoming email (options: SMTP_SERVER_PORT=2525, SMTP_SERVER_HOST=0.0.0.0)"
|
||||
task :reply_email_smtp_server => :environment do
|
||||
desc 'Start STMP server for incoming email (options: SMTP_SERVER_PORT=2525, SMTP_SERVER_HOST=0.0.0.0)'
|
||||
task reply_email_smtp_server: :environment do
|
||||
port = ENV['SMTP_SERVER_PORT'].present? ? ENV['SMTP_SERVER_PORT'].to_i : 2525
|
||||
host = ENV.fetch('SMTP_SERVER_HOST', nil)
|
||||
rake_say "Started SMTP server for incoming email on port #{port}."
|
||||
|
|
@ -64,8 +64,8 @@ namespace :foodsoft do
|
|||
server.join
|
||||
end
|
||||
|
||||
desc "Import and assign bank transactions"
|
||||
task :import_and_assign_bank_transactions => :environment do
|
||||
desc 'Import and assign bank transactions'
|
||||
task import_and_assign_bank_transactions: :environment do
|
||||
BankAccount.find_each do |ba|
|
||||
importer = ba.find_connector
|
||||
next unless importer
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue