forked from Trustie/forgeplus
科技部项目同步木兰镜像用户
This commit is contained in:
parent
2b15792e49
commit
34af5a59eb
|
|
@ -42,18 +42,17 @@ namespace :sync_mulan_repo do
|
|||
def create_repo(data)
|
||||
data.each_with_index do |row, index|
|
||||
begin
|
||||
user = User.find_by(login: 'mirrors')
|
||||
user = User.find 110 if user.blank?
|
||||
user_id = 110
|
||||
tags = row['Tags']
|
||||
repository_name = row['Url'].split("/").last
|
||||
project = user.projects.find_by(identifier: repository_name)
|
||||
project = Project.where(user_id: user_id).where(identifier: repository_name)
|
||||
unless project.present?
|
||||
p_category = ProjectCategory.where(name: tags.split(",")).first
|
||||
p_category = ProjectCategory.find_by(name: '其他') if p_category.blank?
|
||||
p_language = ProjectLanguage.where(name: tags.split(",")).first
|
||||
|
||||
mirror_params = {
|
||||
user_id: user&.id,
|
||||
user_id: 110,
|
||||
name: row['Name'],
|
||||
description: row['Desc'],
|
||||
repository_name: repository_name,
|
||||
|
|
|
|||
Loading…
Reference in New Issue