From 9036a443c06ac9ef6a44d0dc7d9b82844fc4ef0c Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 27 Dec 2019 17:55:57 +0800 Subject: [PATCH] =?UTF-8?q?Jupyter=E6=8F=90=E7=A4=BA=E8=AF=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/shixuns_controller.rb | 31 ++++++++++++++------------- 1 file changed, 16 insertions(+), 15 deletions(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index c871c3064..8a752106c 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -772,7 +772,7 @@ class ShixunsController < ApplicationController # jupyter开启挑战 def jupyter_exec - begin + if is_shixun_opening? tip_show_exception(-3, "#{@shixun.opening_time.strftime('%Y-%m-%d %H:%M:%S')}") end @@ -786,22 +786,23 @@ class ShixunsController < ApplicationController commit_id = commit["id"] cloud_bridge = edu_setting('cloud_bridge') myshixun_identifier = generate_identifier Myshixun, 10 - ActiveRecord::Base.transaction do - @myshixun = @shixun.myshixuns.create!(user_id: current_user.id, identifier: myshixun_identifier, - modify_time: @shixun.modify_time, reset_time: @shixun.reset_time, - onclick_time: Time.now, commit_id: commit_id) - # fork仓库 - project_fork(@myshixun, @repo_path, current_user.login) - rep_url = Base64.urlsafe_encode64(repo_ip_url @repo_path) - uri = "#{cloud_bridge}/bridge/game/openGameInstance" - params = {tpiID: "#{@myshixun.id}", tpmGitURL: rep_url, tpiRepoName: @myshixun.repo_name.split("/").last} - interface_post uri, params, 83, "服务器出现问题,请重置环境" + begin + ActiveRecord::Base.transaction do + @myshixun = @shixun.myshixuns.create!(user_id: current_user.id, identifier: myshixun_identifier, + modify_time: @shixun.modify_time, reset_time: @shixun.reset_time, + onclick_time: Time.now, commit_id: commit_id) + # fork仓库 + project_fork(@myshixun, @repo_path, current_user.login) + rep_url = Base64.urlsafe_encode64(repo_ip_url @repo_path) + uri = "#{cloud_bridge}/bridge/game/openGameInstance" + params = {tpiID: "#{@myshixun.id}", tpmGitURL: rep_url, tpiRepoName: @myshixun.repo_name.split("/").last} + interface_post uri, params, 83, "服务器出现问题,请重置环境" + end + rescue => e + uid_logger_error(e.message) + tip_exception("服务器出现问题,请重置环境") end end - rescue => e - uid_logger_error(e.message) - tip_exception(e.message) - end end def publish