|
|
|
@@ -49,7 +49,8 @@ class SyncProjectsJob < ApplicationJob |
|
|
|
def create_target(target_jsons, target_type) |
|
|
|
SyncLog.sync_log("***【#{target_type}】. begin_to_create_target---------------") |
|
|
|
return SyncLog.sync_log("*** no target_jsons") if target_jsons.blank? |
|
|
|
target_jsons.each do |re| |
|
|
|
target_jsons.each_with_index do |re,index| |
|
|
|
SyncLog.sync_log("***user_login:#{re[:user_login]}----target_type:#{target_type}-----#{index+1}") |
|
|
|
if re[:target_params].present? |
|
|
|
SyncLog.sync_log("***user_login:#{re[:user_login]}----target_type:#{target_type}") |
|
|
|
u_id = User.select(:id, :login).where(login: re[:user_login]).pluck(:id).first |
|
|
|
@@ -86,10 +87,9 @@ class SyncProjectsJob < ApplicationJob |
|
|
|
target_jsons.each do |re| |
|
|
|
old_id = re[:target_params][:id] |
|
|
|
if re[:target_params].present? |
|
|
|
SyncLog.sync_log("***user_login:#{re[:user_login]}----target_type:#{target_type}") |
|
|
|
u_id = User.select(:id, :login).where(login: re[:user_login]).pluck(:id).first |
|
|
|
re[:target_params].delete(:id) |
|
|
|
new_target = target_type.constantize.new(re[:target_params].merge(user_id: u_id)) |
|
|
|
new_target = Version.new(re[:target_params].merge(user_id: u_id)) |
|
|
|
if new_target.save! |
|
|
|
all_issues&.where(fixed_version_id: old_id)&.update_all(fixed_version_id: new_target.id) |
|
|
|
end |
|
|
|
|