diff --git a/app/tasks/sync_user_forge_task.rb b/app/tasks/sync_user_forge_task.rb index d44d33f88..93e79301a 100644 --- a/app/tasks/sync_user_forge_task.rb +++ b/app/tasks/sync_user_forge_task.rb @@ -12,9 +12,10 @@ class SyncUserForgeTask user_params = u.as_json user_extension_params = u.try(:user_extensions).as_json || [] target_params = [] - if u.projects.present? - projects = u.projects.includes(:versions,:repository,:project_score, issues: [:journals],owner: [:user_extensions], members: [roles: [:member_roles]]) - projects.find_each do |p| + user_projects = Project.where(user_id: u.id) + if user_projects.present? + projects = user_projects.includes(:versions,:repository,:project_score, issues: [:journals],owner: [:user_extensions], members: [roles: [:member_roles]]) + projects.each do |p| identifier = p.try(:identifier) if p.repository.present? && p.repository.try(:identifier).present? identifier = p.repository.try(:identifier)