迁移的问题
This commit is contained in:
parent
87be3432cf
commit
912dca0deb
|
@ -6,18 +6,22 @@
|
||||||
class SyncUserForgeTask
|
class SyncUserForgeTask
|
||||||
def call
|
def call
|
||||||
Rails.logger.info("##########_______sync_start________###########")
|
Rails.logger.info("##########_______sync_start________###########")
|
||||||
all_users = User.where("login is not null and id = ?",25728)
|
all_users = User.where("login is not null")
|
||||||
# 这里再把所有用户循环
|
# 这里再把所有用户循环
|
||||||
all_users.find_each do |u|
|
all_users.find_each do |u|
|
||||||
# u = User.find(36390) 测试的
|
|
||||||
user_params = u.as_json
|
user_params = u.as_json
|
||||||
user_extension_params = u.try(:user_extensions).as_json || []
|
user_extension_params = u.try(:user_extensions).as_json || []
|
||||||
target_params = []
|
target_params = []
|
||||||
if u.projects.present?
|
if u.projects.present?
|
||||||
projects = u.projects.includes(:versions,:project_score, issues: [:journals],owner: [:user_extensions], members: [roles: [:member_roles]])
|
projects = u.projects.includes(:versions,:repository,:project_score, issues: [:journals],owner: [:user_extensions], members: [roles: [:member_roles]])
|
||||||
projects.find_each do |p|
|
projects.find_each do |p|
|
||||||
|
identifier = p.try(:identifier)
|
||||||
|
if p.repository.present? && p.repository.try(:identifier).present?
|
||||||
|
identifier = p.repository.try(:identifier)
|
||||||
|
end
|
||||||
member_params = get_members(p.members,p)
|
member_params = get_members(p.members,p)
|
||||||
project_params = p.as_json
|
project_params = p.as_json
|
||||||
|
project_params["project"]["identifier"] = identifier
|
||||||
issue_params = get_issues(p, u.id)
|
issue_params = get_issues(p, u.id)
|
||||||
versions_params = get_versions(p)
|
versions_params = get_versions(p)
|
||||||
project_score_params = get_scores(p)
|
project_score_params = get_scores(p)
|
||||||
|
|
Loading…
Reference in New Issue