|
|
|
@ -33,7 +33,7 @@ class GamesController < ApplicationController
|
|
|
|
|
is_teacher = @user.is_teacher?
|
|
|
|
|
|
|
|
|
|
# 实训超时设置
|
|
|
|
|
time_limit = @shixun.exec_time
|
|
|
|
|
time_limit = game_challenge.exec_time
|
|
|
|
|
|
|
|
|
|
# 上一关、下一关
|
|
|
|
|
prev_game = @game.prev_of_current_game(@shixun.id, @game.myshixun_id, game_challenge.position)
|
|
|
|
@ -52,7 +52,7 @@ class GamesController < ApplicationController
|
|
|
|
|
record_onsume_time = EvaluateRecord.where(game_id: @game.id).first.try(:consume_time)
|
|
|
|
|
|
|
|
|
|
# myshixun_manager判断用户是否有权限查看隐藏测试集(TPM管理员;平台认证的老师;花费金币查看者)
|
|
|
|
|
myshixun_manager = @identity < USER::EDU_GAME_MANAGER
|
|
|
|
|
myshixun_manager = @identity < User::EDU_GAME_MANAGER
|
|
|
|
|
|
|
|
|
|
# 选择题和编程题公共部分
|
|
|
|
|
@base_date = {st: @st, discusses_count: discusses_count, game_count: game_count, myshixun: @myshixun,
|
|
|
|
@ -66,7 +66,7 @@ class GamesController < ApplicationController
|
|
|
|
|
shixun_tomcat = edu_setting('cloud_bridge')
|
|
|
|
|
service_host = edu_setting('vnc_url')
|
|
|
|
|
uri = "#{shixun_tomcat}/bridge/vnc/getvnc"
|
|
|
|
|
params = {tpiID: @myshixun.id, :containers => "#{Base64.urlsafe_encode64(container_limit(@shixun.mirror_repositories))}"}
|
|
|
|
|
params = {tpiID: @myshixun.id, :containers => "#{Base64.urlsafe_encode64(shixun_container_limit(@shixun))}"}
|
|
|
|
|
res = uri_post uri, params
|
|
|
|
|
if res && res['code'].to_i != 0
|
|
|
|
|
raise("实训云平台繁忙(繁忙等级:99)")
|
|
|
|
@ -426,12 +426,12 @@ class GamesController < ApplicationController
|
|
|
|
|
game_code = GameCode.where(:game_id => @game.try(:id), :path => path).first
|
|
|
|
|
if game_code.present?
|
|
|
|
|
content = game_code.try(:new_code)
|
|
|
|
|
@content = if @myshixun.mirror_name.select{|a| a.include?("MachineLearning") || a.include?("Python")}.present? && content.present?
|
|
|
|
|
content.gsub(/\t/, ' ')
|
|
|
|
|
else
|
|
|
|
|
content
|
|
|
|
|
end
|
|
|
|
|
update_file_content(@content, @myshixun.repo_path, path, current_user.mail, current_user.full_name, "game passed reset")
|
|
|
|
|
# @content = if @myshixun.mirror_name.select{|a| a.include?("MachineLearning") || a.include?("Python")}.present? && content.present?
|
|
|
|
|
# content.gsub(/\t/, ' ')
|
|
|
|
|
# else
|
|
|
|
|
# content
|
|
|
|
|
# end
|
|
|
|
|
update_file_content(content, @myshixun.repo_path, path, current_user.mail, current_user.full_name, "game passed reset")
|
|
|
|
|
else
|
|
|
|
|
tip_exception("代码重置失败,代码为空")
|
|
|
|
|
end
|
|
|
|
@ -461,6 +461,7 @@ class GamesController < ApplicationController
|
|
|
|
|
git_fle_content(@myshixun.shixun.repo_path, path)
|
|
|
|
|
rescue Exception => e
|
|
|
|
|
uid_logger_error("#{e.message}")
|
|
|
|
|
# 如果已发布的TPM实训也不能获取到内容,那么肯定是版本库异常了
|
|
|
|
|
if @myshixun.shixun.try(:status) < 2
|
|
|
|
|
tip_exception("代码获取异常,请检查实训模板的评测设置是否正确")
|
|
|
|
|
else
|
|
|
|
@ -546,7 +547,7 @@ class GamesController < ApplicationController
|
|
|
|
|
br_params = {:tpiID => "#{@myshixun.id}", :tpiGitURL => "#{gitUrl}", :buildID => "#{@game.id}",
|
|
|
|
|
:instanceChallenge => "#{step}", :testCases => "#{testCases}", :resubmit => "#{resubmit}",
|
|
|
|
|
:times => params[:first].to_i, :podType => @shixun.webssh, :content_modified => content_modified,
|
|
|
|
|
:containers => "#{Base64.urlsafe_encode64(container_limit(@shixun.mirror_repositories))}",
|
|
|
|
|
:containers => "#{Base64.urlsafe_encode64(shixun_container_limit(@shixun))}",
|
|
|
|
|
:persistenceName => @shixun.identifier, :tpmScript => "#{tpmScript}",
|
|
|
|
|
:timeLimit => "#{@shixun.exec_time}", :isPublished => (@shixun.status < 2 ? 0 : 1) }
|
|
|
|
|
|
|
|
|
|