From fc3832da3588a88d78e5bb16bb2fd4acc7845b15 Mon Sep 17 00:00:00 2001 From: Bohung Date: Tue, 4 Jan 2022 09:46:29 +0800 Subject: [PATCH] Add sync certain user_names feature in rake. --- lib/tasks/sync_asia_personal_data_tasks.rake | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/tasks/sync_asia_personal_data_tasks.rake b/lib/tasks/sync_asia_personal_data_tasks.rake index 20a16f3..0333e89 100644 --- a/lib/tasks/sync_asia_personal_data_tasks.rake +++ b/lib/tasks/sync_asia_personal_data_tasks.rake @@ -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)