Add sync certain user_names feature in rake.

This commit is contained in:
BoHung Chiu 2022-01-04 09:46:29 +08:00
parent 6ecb0a204e
commit fc3832da35
1 changed files with 6 additions and 2 deletions

View File

@ -362,8 +362,12 @@ module AsiaSyncPlugin
end
namespace :sync_asia_personal_plugins do
desc 'sync_personal_plugins from Asia'
task :sync => [:environment] do
users = User.all.to_a
task :sync,[:user_names] => [:environment] do |task,args|
if args.user_names
users = User.where(:user_name.in=>YAML.load(args.user_names)).to_a
else
users = User.all.to_a
end
users.each do |user|
puts "Fetching data for #{user.user_name}..."
query_result = get_sync_data(user.user_name)