Merge branch 'dev_trustie' into dev_chain
This commit is contained in:
commit
ab2fe592ec
|
@ -23,7 +23,7 @@ class SyncProjectsJob < ApplicationJob
|
|||
SyncLog.sync_log("==========target_jsons: #{target_jsons}============")
|
||||
update_new_project(target_jsons[:targets_params][0], sync_params[:new_project_id])
|
||||
else
|
||||
create_target(project, target_jsons[:targets_params], sync_params[:type].to_s)
|
||||
create_target(target_jsons[:targets_params], sync_params[:type].to_s)
|
||||
end
|
||||
else
|
||||
SyncLog.sync_log("==========sync_project_to_forge_failed #{sync_params[:type]}============")
|
||||
|
@ -47,11 +47,12 @@ class SyncProjectsJob < ApplicationJob
|
|||
end
|
||||
|
||||
|
||||
def create_target(project, target_jsons, target_type)
|
||||
Rails.logger.info("***【#{target_type}】. begin_to_create_target---------------")
|
||||
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|
|
||||
if re[:target_params].present?
|
||||
Rails.logger.info("***user_login:#{re[:user_login]}----target_type:#{target_type}")
|
||||
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
|
||||
|
||||
new_target = target_type.constantize.new(re[:target_params].merge(user_id: u_id))
|
||||
|
@ -60,7 +61,7 @@ class SyncProjectsJob < ApplicationJob
|
|||
assing_u_id = User.select(:id, :login).where(login: re[:assign_login]).pluck(:id).first
|
||||
new_target.assigned_to_id = assing_u_id
|
||||
if re[:journals].present?
|
||||
create_target(project, re[:journals], "Journal")
|
||||
create_target(re[:journals], "Journal")
|
||||
end
|
||||
end
|
||||
if new_target.save!
|
||||
|
@ -72,6 +73,6 @@ class SyncProjectsJob < ApplicationJob
|
|||
end
|
||||
end
|
||||
end
|
||||
Rails.logger.info("***111222. end_to_create_target---------------")
|
||||
SyncLog.sync_log("***111222. end_to_create_target---------------")
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue