From ca7de7fbf3eb31a662b1692c593cc4932bb1f391 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 25 Dec 2019 19:20:59 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E5=85=B3=E5=8D=A1=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/games_controller.rb | 4 ---- app/views/challenges/show.json.jbuilder | 2 +- 2 files changed, 1 insertion(+), 5 deletions(-) diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index a5cb1ece3..938d42c2f 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -10,9 +10,6 @@ class GamesController < ApplicationController include GamesHelper include ApplicationHelper - - - def show uid_logger("--games show start") # 防止评测中途ajaxE被取消;3改成0是为了处理首次进入下一关的问题 @@ -91,7 +88,6 @@ class GamesController < ApplicationController end end - def jupyter # Jupyter没有challenge @myshixun = Myshixun.find_by_identifier params[:identifier] diff --git a/app/views/challenges/show.json.jbuilder b/app/views/challenges/show.json.jbuilder index cffe77ebb..fb86683b4 100644 --- a/app/views/challenges/show.json.jbuilder +++ b/app/views/challenges/show.json.jbuilder @@ -1,6 +1,6 @@ # 导航栏公共数据 json.partial! "challenges/top_common_data", shixun_identifier: @shixun.identifier -json.(@challenge, :id, :subject, :task_pass, :difficulty, :score, :exec_time) +json.(@challenge, :id, :subject, :task_pass, :difficulty, :score, :exec_time, :st) json.tags @challenge.challenge_tags.map(&:name) From e5faa5e2783965be016b3ca339a659f297179218 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 25 Dec 2019 19:30:15 +0800 Subject: [PATCH 2/6] 1 --- app/views/challenges/edit.json.jbuilder | 4 +++- app/views/challenges/edit_choose_question.json.jbuilder | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/app/views/challenges/edit.json.jbuilder b/app/views/challenges/edit.json.jbuilder index 3e7f5b425..c0ea68d9c 100644 --- a/app/views/challenges/edit.json.jbuilder +++ b/app/views/challenges/edit.json.jbuilder @@ -5,9 +5,11 @@ json.chooses do json.type choose.category end end +json.st @challenge.st + if @tab == 0 # 本关任务tab的编辑模式 - json.(@challenge, :id, :subject, :task_pass, :difficulty, :score, :exec_time) + json.(@challenge, :id, :subject, :task_pass, :difficulty, :score, :exec_time, :st) json.tags @challenge.challenge_tags.map(&:name) elsif @tab == 1 # 评测设置的编辑模式 diff --git a/app/views/challenges/edit_choose_question.json.jbuilder b/app/views/challenges/edit_choose_question.json.jbuilder index 663f27d7f..0405c0598 100644 --- a/app/views/challenges/edit_choose_question.json.jbuilder +++ b/app/views/challenges/edit_choose_question.json.jbuilder @@ -1,7 +1,7 @@ json.(@challenge_choose, :challenge_id, :subject, :answer, :standard_answer, :score, :difficult, :position, :category) - +json.st @challenge.st # 选项的参数 json.choose_contents @challenge_choose.challenge_questions do |question| json.(question, :option_name, :position, :right_key) From d15b5b2907908e1e7322aa195c353575460a3405 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Wed, 25 Dec 2019 20:20:03 +0800 Subject: [PATCH 3/6] 1 --- .../record_detail.json.jbuilder | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/app/views/hack_user_lastest_codes/record_detail.json.jbuilder b/app/views/hack_user_lastest_codes/record_detail.json.jbuilder index 8f72014fe..66eedf85e 100644 --- a/app/views/hack_user_lastest_codes/record_detail.json.jbuilder +++ b/app/views/hack_user_lastest_codes/record_detail.json.jbuilder @@ -1,8 +1,12 @@ -json.(@hack_user, :id, :status, :error_line, :error_msg, :expected_output, - :input, :output, :execute_time, :execute_memory, :created_at, :code) -json.language @hack_user.hack.language -json.name @hack_user.hack.name -json.myproblem_identifier @my_hack.identifier -json.user do - json.partial! 'users/user', user: current_user -end \ No newline at end of file +json.status 0 +json.message "返回成功" +json.data do + json.(@hack_user, :id, :status, :error_line, :error_msg, :expected_output, + :input, :output, :execute_time, :execute_memory, :created_at, :code) + json.language @hack_user.hack.language + json.name @hack_user.hack.name + json.myproblem_identifier @my_hack.identifier + json.user do + json.partial! 'users/user', user: current_user + end +end From a04917fa2946ba4c33192ba4e6ecebd5b19d013f Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 26 Dec 2019 09:17:32 +0800 Subject: [PATCH 4/6] VNC --- app/controllers/shixuns_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 992bd87f8..59dd20633 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -467,7 +467,7 @@ class ShixunsController < ApplicationController def update_learn_setting begin ActiveRecord::Base.transaction do - @shixun.update_attributes!(shixun_params) + @shixun.update_attributes!(shixun_params.merge(vnc_evaluate: 1)) end rescue => e uid_logger_error("实训学习页面设置失败--------#{e.message}") From bea09a024bac3a5968cacc64ad243ac05072e571 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 26 Dec 2019 09:20:22 +0800 Subject: [PATCH 5/6] VNC --- app/controllers/shixuns_controller.rb | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index 59dd20633..f58235ac4 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -467,7 +467,13 @@ class ShixunsController < ApplicationController def update_learn_setting begin ActiveRecord::Base.transaction do - @shixun.update_attributes!(shixun_params.merge(vnc_evaluate: 1)) + update_params = + if params[:shixun][:vnc].to_i == 1 + shixun_params.merge(vnc_evaluate: 1) + else + shixun_params + end + @shixun.update_attributes!(update_params) end rescue => e uid_logger_error("实训学习页面设置失败--------#{e.message}") From a0ce273cac62f821693475146d9cd90b7306e227 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 26 Dec 2019 09:24:10 +0800 Subject: [PATCH 6/6] 1 --- app/controllers/shixuns_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/shixuns_controller.rb b/app/controllers/shixuns_controller.rb index f58235ac4..bb475abcd 100644 --- a/app/controllers/shixuns_controller.rb +++ b/app/controllers/shixuns_controller.rb @@ -468,7 +468,7 @@ class ShixunsController < ApplicationController begin ActiveRecord::Base.transaction do update_params = - if params[:shixun][:vnc].to_i == 1 + if params[:shixun][:vnc] shixun_params.merge(vnc_evaluate: 1) else shixun_params