Merge branch 'develop' of https://bdgit.trustie.net/hushasha/bigdata into develop

This commit is contained in:
XuCheng642 2017-10-13 21:44:03 +08:00
commit f52960e2eb
1 changed files with 14 additions and 5 deletions

View File

@ -91,11 +91,20 @@ class GamesController < ApplicationController
# git_repository_url @myshixun, "Myshixun"
# @st 0 实践任务 1 选择题任务
def show
# g = Gitlab.client
# g_name = g.project(@myshixun.gpid).try(:name)
# if g_name.include?("-")
# g.delete_project()
# end
g = Gitlab.client
g_name = g.project(@myshixun.gpid).try(:name)
g_rep = @myshixun.repository
g_identifier = g_rep.try(:identifier)
if g_name.include?("-") || g_identifier.include?("-")
g_user_id = @myshixun.owner.try(:gid)
g_name = g_name.split("-")
g_project_name = g_name[0]
num = g_name[1]
g_id = g.current_user_project(g_user_id, g_project_name).first.try(:id)
sql = "update `repositories` set identifier='#{g_project_name}' where id=#{g_rep.id}"
ActiveRecord::Base.connection.execute(sql)
@myshixun.update_attribute(:gpid, g_id)
end
# 展示全部实训
# git_myshixun_url_ip @myshixun, user_id
@is_subject = params[:is_subject]