实训平台的一些优化
This commit is contained in:
parent
63f9295f6f
commit
13e14770ed
|
|
@ -30,7 +30,7 @@ class ShixunsController < ApplicationController
|
|||
def achieve_ways
|
||||
@repository = @shixun.repository
|
||||
@entries = @repository.entries(@path, @rev)
|
||||
@entries = Gitlab.client.trees(@shixun.gpid).map{|tree| tree.name}
|
||||
# @entries = Gitlab.client.trees(@shixun.gpid).map{|tree| tree.name}
|
||||
end
|
||||
|
||||
def statistics_students
|
||||
|
|
@ -53,7 +53,7 @@ class ShixunsController < ApplicationController
|
|||
|
||||
# push代码的时候会触发gitlab hook
|
||||
def ghook
|
||||
shixun_modify_status_without_publish(@shixun, 1)
|
||||
# shixun_modify_status_without_publish(@shixun, 1)
|
||||
render :json => {status: "success"}
|
||||
end
|
||||
|
||||
|
|
@ -93,8 +93,8 @@ class ShixunsController < ApplicationController
|
|||
logger.info("************#{tpiList}")
|
||||
end
|
||||
end
|
||||
# tpiList = Base64.urlsafe_encode64(tpiList.to_json) unless tpiList.blank?
|
||||
params = {:gameInfo => "#{gameInfo}" }
|
||||
tpiList = Base64.urlsafe_encode64(tpiList.to_json) unless tpiList.blank?
|
||||
params = {:gameInfo => "#{gameInfo}", :tpiList => "#{tpiList}" }
|
||||
logger.info("params is #{params}")
|
||||
uri = "#{shixun_tomcat}/bridge/dataTransfer/transfer"
|
||||
logger.info("uri is #{uri}")
|
||||
|
|
@ -135,7 +135,7 @@ class ShixunsController < ApplicationController
|
|||
@path = params[:path]
|
||||
@rev = params[:rev]
|
||||
file_content = g.files(@shixun.gpid, @path, @rev).content
|
||||
@content = tran_base64_decode64(file_content) unless file_content.blank?
|
||||
@content = tran_base64_decode64(file_content)
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
|
|
@ -157,14 +157,14 @@ class ShixunsController < ApplicationController
|
|||
end
|
||||
|
||||
def shixun_monitor
|
||||
monitor_filter
|
||||
if @had_exec
|
||||
@tpm = Myshixun.where(:user_id => User.current, :shixun_id => @shixun).first
|
||||
end
|
||||
|
||||
respond_to do |format|
|
||||
format.js
|
||||
end
|
||||
# monitor_filter
|
||||
# if @had_exec
|
||||
# @tpm = Myshixun.where(:user_id => User.current, :shixun_id => @shixun).first
|
||||
# end
|
||||
#
|
||||
# respond_to do |format|
|
||||
# format.js
|
||||
# end
|
||||
end
|
||||
|
||||
def statistics
|
||||
|
|
@ -472,7 +472,7 @@ class ShixunsController < ApplicationController
|
|||
logger.info("start openGameInstance")
|
||||
uri = "#{shixun_tomcat}/bridge/game/openGameInstance"
|
||||
logger.info("end openGameInstance")
|
||||
params = {tpiID: "#{myshixun.id}", tpmID: "#{@shixun.id}", instanceGitURL:rep_url, operationEnvironment:"#{@shixun.try(:language)}"}
|
||||
params = {tpmID: "#{@shixun.id}", tpiID: "#{myshixun.id}", tpmID: "#{@shixun.id}", instanceGitURL:rep_url, operationEnvironment:"#{@shixun.try(:language)}"}
|
||||
logger.info("openGameInstance params is #{params}")
|
||||
res = uri_exec uri, params
|
||||
if (res && res['code'].to_i != 0)
|
||||
|
|
@ -742,7 +742,7 @@ class ShixunsController < ApplicationController
|
|||
end
|
||||
|
||||
def generate_identifier
|
||||
code = DCODES.sample(12).join
|
||||
code = DCODES.sample(8).join
|
||||
return generate_identifier if Shixun.where(identifier: code).present?
|
||||
code
|
||||
end
|
||||
|
|
@ -768,13 +768,13 @@ class ShixunsController < ApplicationController
|
|||
@shixun.trainee = params[:trainee]
|
||||
@shixun.webssh = params[:webssh].to_i
|
||||
@shixun.can_copy = params[:can_copy].to_i
|
||||
if params[:course_id]
|
||||
@shixun.shixun_major_courses.destroy_all
|
||||
params[:course_id].each do |course_id|
|
||||
@shixun.shixun_major_courses << ShixunMajorCourse.new(:major_id => params[:major_id], :course_list_id => course_id)
|
||||
end
|
||||
end
|
||||
@shixun.major_id = params[:major_id]
|
||||
# if params[:course_id]
|
||||
# @shixun.shixun_major_courses.destroy_all
|
||||
# params[:course_id].each do |course_id|
|
||||
# @shixun.shixun_major_courses << ShixunMajorCourse.new(:major_id => params[:major_id], :course_list_id => course_id)
|
||||
# end
|
||||
# end
|
||||
# @shixun.major_id = params[:major_id]
|
||||
@shixun.shixun_major_courses.destroy_all
|
||||
course_lists = params[:course_list].strip.split(",")
|
||||
course_lists.each do |course|
|
||||
|
|
|
|||
Loading…
Reference in New Issue