|
|
|
@ -221,12 +221,17 @@ class SubjectsController < ApplicationController
|
|
|
|
|
# 添加合作者
|
|
|
|
|
@shixun.shixun_members.create!(user_id: current_user.id, role: 1)
|
|
|
|
|
# 创建长字段
|
|
|
|
|
ShixunInfo.create!(shixun_id: @shixun.id)
|
|
|
|
|
ShixunInfo.create!(shixun_id: @shixun.id, description: "请在此处添加实训描述")
|
|
|
|
|
# 创建版本库
|
|
|
|
|
repo_path = repo_namespace(current_user.login, identifier)
|
|
|
|
|
GitService.add_repository(repo_path: repo_path)
|
|
|
|
|
# todo: 为什么保存的时候要去除后面的.git呢??
|
|
|
|
|
@shixun.update_column(:repo_name, repo_path.split(".")[0])
|
|
|
|
|
mirror_id = MirrorRepository.find_by(type_name: 'Python').id
|
|
|
|
|
if mirror_id
|
|
|
|
|
ShixunMirrorRepository.create!(:shixun_id => @shixun.id, :mirror_repository_id => mirror_id)
|
|
|
|
|
@shixun.shixun_service_configs.create!(:shixun_id => @shixun.id, :mirror_repository_id => mirror_id)
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|