From feca7e315812f70aa8feaaa4d89a172d7d605194 Mon Sep 17 00:00:00 2001
From: SylorHuang
Date: Wed, 11 Dec 2019 15:33:19 +0800
Subject: [PATCH 01/14] =?UTF-8?q?=E6=B5=8B=E8=AF=95=E5=90=8C=E6=AD=A5?=
=?UTF-8?q?=E5=88=B0trustie?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/application_record.rb | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/app/models/application_record.rb b/app/models/application_record.rb
index 888c65423..60308f4d8 100644
--- a/app/models/application_record.rb
+++ b/app/models/application_record.rb
@@ -14,6 +14,7 @@ class ApplicationRecord < ActiveRecord::Base
end
def allow_sync_to_trustie?
- Rails.env.production? && EduSetting.get('host_name') == 'https://www.educoder.net'
+ true
+ # Rails.env.production? && EduSetting.get('host_name') == 'https://www.educoder.net'
end
end
From 64bea22d70264a11493923ecdff45f28fd9d0c58 Mon Sep 17 00:00:00 2001
From: daiao <358551898@qq.com>
Date: Wed, 11 Dec 2019 15:35:46 +0800
Subject: [PATCH 02/14] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=B5=8B=E8=AF=95?=
=?UTF-8?q?=E9=9B=86=E5=A4=B1=E8=B4=A5?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/controllers/challenges_controller.rb | 112 +++++++++---------
...0191211073142_modify_type_for_test_sets.rb | 7 ++
2 files changed, 66 insertions(+), 53 deletions(-)
create mode 100644 db/migrate/20191211073142_modify_type_for_test_sets.rb
diff --git a/app/controllers/challenges_controller.rb b/app/controllers/challenges_controller.rb
index 0b5140743..4528b7b90 100644
--- a/app/controllers/challenges_controller.rb
+++ b/app/controllers/challenges_controller.rb
@@ -173,64 +173,70 @@ class ChallengesController < ApplicationController
# tab 0:过关任务的更新; 1:评测设置的更新; 2:表示参考答案的更新;
def update
- ActiveRecord::Base.transaction do
- tab = params[:tab].to_i
- @challenge.update_attributes(challenge_params)
- if tab == 0 && @challenge.st == 0
- @challenge.challenge_tags.delete_all
- if params[:challenge_tag].present?
- params[:challenge_tag].each do |input|
- ChallengeTag.create!(:name => input, :challenge_id => @challenge.id)
+ begin
+ ActiveRecord::Base.transaction do
+ tab = params[:tab].to_i
+ @challenge.update_attributes(challenge_params)
+ if tab == 0 && @challenge.st == 0
+ @challenge.challenge_tags.delete_all
+ if params[:challenge_tag].present?
+ params[:challenge_tag].each do |input|
+ ChallengeTag.create!(:name => input, :challenge_id => @challenge.id)
+ end
end
- end
- elsif tab == 1
- path = @challenge.path
- exec_path = @challenge.exec_path
- test_set = @challenge.test_sets
- sets_output = test_set.map(&:output)
- sets_input = test_set.map(&:input)
- sets_open = test_set.map(&:is_public)
- set_score = test_set.map(&:score)
- set_match_rule = test_set.map(&:match_rule)
- params_hidden = params[:test_set].map{|set| set[:hidden].to_i == 0}
- params_output = params[:test_set].map{|set| set[:output] }
- params_input = params[:test_set].map{|set| set[:input] }
- params_score = params[:test_set].map{|set| set[:score]}
- params_test_set = params[:test_set].map{|set| set[:match_rule]}
- # 测试集变化则需要更新(输入、 输出、 是否隐藏)
- if sets_output != params_output || sets_open != params_hidden || sets_input != params_input ||
- set_score != params_score || params_test_set != set_match_rule
- test_set.delete_all unless test_set.blank?
- params[:test_set].each_with_index do |set, index|
- # last: 末尾匹配, full: 全完匹配
- logger.info("set: #{set}; match_rule : #{set[:match_rule]}")
- match_rule = set[:match_rule] == 'last' ? 'last' : 'full'
- TestSet.create(:challenge_id => @challenge.id,
- :input => "#{set[:input]}",
- :output => "#{set[:output]}",
- :is_public => params_hidden[index],
- :score => set[:score],
- :match_rule => "#{match_rule}",
- :position => (index + 1))
+ elsif tab == 1
+ path = @challenge.path
+ exec_path = @challenge.exec_path
+ test_set = @challenge.test_sets
+ sets_output = test_set.map(&:output)
+ sets_input = test_set.map(&:input)
+ sets_open = test_set.map(&:is_public)
+ set_score = test_set.map(&:score)
+ set_match_rule = test_set.map(&:match_rule)
+ params_hidden = params[:test_set].map{|set| set[:hidden].to_i == 0}
+ params_output = params[:test_set].map{|set| set[:output] }
+ params_input = params[:test_set].map{|set| set[:input] }
+ params_score = params[:test_set].map{|set| set[:score]}
+ params_test_set = params[:test_set].map{|set| set[:match_rule]}
+ # 测试集变化则需要更新(输入、 输出、 是否隐藏)
+ if sets_output != params_output || sets_open != params_hidden || sets_input != params_input ||
+ set_score != params_score || params_test_set != set_match_rule
+ test_set.delete_all unless test_set.blank?
+ params[:test_set].each_with_index do |set, index|
+ # last: 末尾匹配, full: 全完匹配
+ logger.info("set: #{set}; match_rule : #{set[:match_rule]}")
+ match_rule = set[:match_rule] == 'last' ? 'last' : 'full'
+ TestSet.create(:challenge_id => @challenge.id,
+ :input => "#{set[:input]}",
+ :output => "#{set[:output]}",
+ :is_public => params_hidden[index],
+ :score => set[:score],
+ :match_rule => "#{match_rule}",
+ :position => (index + 1))
+ end
+ @challenge.update_column(:modify_time, Time.now)
+ # 测试集的
+ @shixun.myshixuns.update_all(:system_tip => 0)
end
- @challenge.update_column(:modify_time, Time.now)
- # 测试集的
- @shixun.myshixuns.update_all(:system_tip => 0)
- end
- if params[:challenge][:show_type].to_i == -1
- @challenge.update_attributes(picture_path: nil, web_route: nil, expect_picture_path: nil, original_picture_path: nil)
+ if params[:challenge][:show_type].to_i == -1
+ @challenge.update_attributes(picture_path: nil, web_route: nil, expect_picture_path: nil, original_picture_path: nil)
+ end
+ # 关卡评测执行文件如果被修改,需要修改脚本内容
+ script = modify_shixun_script @shixun, @shixun.evaluate_script
+ @shixun.shixun_info.update_column(:evaluate_script, script)
+ # TODO:
+ # if path != params[:challenge][:path]
+ # shixun_modify_status_without_publish(@shixun, 1)
+ # end
+ #Attachment.attach_files(@challenge, params[:attachments])
end
- # 关卡评测执行文件如果被修改,需要修改脚本内容
- script = modify_shixun_script @shixun, @shixun.evaluate_script
- @shixun.shixun_info.update_column(:evaluate_script, script)
- # TODO:
- # if path != params[:challenge][:path]
- # shixun_modify_status_without_publish(@shixun, 1)
- # end
- #Attachment.attach_files(@challenge, params[:attachments])
- end
+ end
+ rescue => e
+ logger_error("##update_challenges: ##{e.message}")
+ tip_exception("更新失败!")
end
+
end
# 参考答案的'增,删,改'
diff --git a/db/migrate/20191211073142_modify_type_for_test_sets.rb b/db/migrate/20191211073142_modify_type_for_test_sets.rb
new file mode 100644
index 000000000..7b5c8dfef
--- /dev/null
+++ b/db/migrate/20191211073142_modify_type_for_test_sets.rb
@@ -0,0 +1,7 @@
+class ModifyTypeForTestSets < ActiveRecord::Migration[5.2]
+ def change
+ change_column :test_sets, :input, :longtext
+ change_column :test_sets, :output, :longtext
+
+ end
+end
From e8a1045316d17e0fc7031a3f297c59d1c517cbaf Mon Sep 17 00:00:00 2001
From: SylorHuang
Date: Wed, 11 Dec 2019 16:10:00 +0800
Subject: [PATCH 03/14] =?UTF-8?q?=E4=BF=AE=E6=94=B9sync=5Ftrustie=5Fjob.rb?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/jobs/sync_trustie_job.rb | 11 +++++++++--
1 file changed, 9 insertions(+), 2 deletions(-)
diff --git a/app/jobs/sync_trustie_job.rb b/app/jobs/sync_trustie_job.rb
index 33df5b529..dec09debc 100644
--- a/app/jobs/sync_trustie_job.rb
+++ b/app/jobs/sync_trustie_job.rb
@@ -17,10 +17,17 @@ class SyncTrustieJob < ApplicationJob
"number": count
}
uri = URI.parse(url)
+ # http = Net::HTTP.new(uri.hostname, uri.port)
+
if api_host
http = Net::HTTP.new(uri.hostname, uri.port)
- http.send_request('PUT', uri.path, sync_json.to_json, {'Content-Type' => 'application/json'})
- Rails.logger.info("#######_________response__sync__end_____#########")
+
+ if api_host.include?("https://")
+ http.use_ssl = true
+ end
+
+ response = http.send_request('PUT', uri.path, sync_json.to_json, {'Content-Type' => 'application/json'})
+ Rails.logger.info("#######_________response__sync__end_____#########{response.body}")
end
end
end
From 7b304da2da39d187c4292dbe7347aa168431f285 Mon Sep 17 00:00:00 2001
From: SylorHuang
Date: Wed, 11 Dec 2019 16:13:02 +0800
Subject: [PATCH 04/14] =?UTF-8?q?=E4=BF=AE=E6=94=B9application=5Frecord?=
=?UTF-8?q?=E9=87=8C=E7=9A=84allow=5Fsync=5Fto=5Ftrusti?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/models/application_record.rb | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/app/models/application_record.rb b/app/models/application_record.rb
index 60308f4d8..888c65423 100644
--- a/app/models/application_record.rb
+++ b/app/models/application_record.rb
@@ -14,7 +14,6 @@ class ApplicationRecord < ActiveRecord::Base
end
def allow_sync_to_trustie?
- true
- # Rails.env.production? && EduSetting.get('host_name') == 'https://www.educoder.net'
+ Rails.env.production? && EduSetting.get('host_name') == 'https://www.educoder.net'
end
end
From 20bff9a125120867d5dae2486fafa519a299511f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com>
Date: Wed, 11 Dec 2019 21:27:16 +0800
Subject: [PATCH 05/14] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
public/react/src/modules/page/VNCContainer.js | 10 +++++-----
1 file changed, 5 insertions(+), 5 deletions(-)
diff --git a/public/react/src/modules/page/VNCContainer.js b/public/react/src/modules/page/VNCContainer.js
index 8164f052a..aa4d82e78 100644
--- a/public/react/src/modules/page/VNCContainer.js
+++ b/public/react/src/modules/page/VNCContainer.js
@@ -38,9 +38,9 @@ class VNCContainer extends Component {
}
- shouldComponentUpdate () {
- return false;
- }
+ // shouldComponentUpdate () {
+ // return false;
+ // }
getSecondDrawerWidth = () => {
return $('#game_right_contents').width() - firstDrawerWidth
@@ -337,11 +337,11 @@ class VNCContainer extends Component {
width={firstDrawerWidth}
closable={false}
onClose={this.onBottomDrawerClose}
- visible={this.state.bottomDrawer}
+ visible={this.state.bottomDrawer===undefined?false:this.state.bottomDrawer}
className={'codeEvaluateDrawer'}
placement="bottom"
getContainer={false}
- style={{ position: 'absolute', bottom: '25px', zIndex: 1 }}
+ style={{ position: 'absolute', bottom: '-25px', zIndex: 1 }}
afterVisibleChange={(visible) => {
if (visible) {
const canvas = $('.vncDisply canvas')[0]
From 187925a71ba9dd2fb2038479b3eb08b85b7f186d Mon Sep 17 00:00:00 2001
From: cxt <853663049@qq.com>
Date: Thu, 12 Dec 2019 09:46:36 +0800
Subject: [PATCH 06/14] =?UTF-8?q?=E5=AF=BC=E5=87=BA=E5=88=86=E7=8F=AD?=
=?UTF-8?q?=E5=AD=A6=E7=94=9F=E6=88=90=E7=BB=A9?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
app/helpers/export_helper.rb | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/app/helpers/export_helper.rb b/app/helpers/export_helper.rb
index 31e1ecf45..12f1ccdae 100644
--- a/app/helpers/export_helper.rb
+++ b/app/helpers/export_helper.rb
@@ -163,9 +163,12 @@ module ExportHelper
count_2 = common_homeworks.size
count_3 = group_homeworks.size
count_4 = tasks.size
+
+ all_user_ids = all_members.pluck(:user_id)
+
#实训作业
shixun_homeworks.each_with_index do |s,index|
- all_student_works = s.score_student_works #该实训题的全部用户回答
+ all_student_works = s.score_student_works.select{|work| all_user_ids.include?(work.user_id)} #该实训题的全部用户回答
title_no = index.to_i + 1
student_work_to_xlsx(all_student_works,s)
shixun_work_display_name = format_sheet_name (title_no.to_s + "." + s.name).strip.first(30)
@@ -175,7 +178,7 @@ module ExportHelper
#普通作业
common_homeworks.each_with_index do |c,index|
- all_student_works = c.score_student_works #当前用户的对该作业的回答
+ all_student_works = c.score_student_works.select{|work| all_user_ids.include?(work.user_id)} #当前用户的对该作业的回答
title_no = count_1 + index.to_i + 1
student_work_to_xlsx(all_student_works,c)
@@ -187,7 +190,7 @@ module ExportHelper
#分组作业
group_homeworks.each_with_index do |c,index|
- all_student_works = c.score_student_works #当前用户的对该作业的回答
+ all_student_works = c.score_student_works.select{|work| all_user_ids.include?(work.user_id)} #当前用户的对该作业的回答
title_no = count_1 + count_2 + index.to_i + 1
student_work_to_xlsx(all_student_works,c)
work_name = format_sheet_name (title_no.to_s + "." + c.name).strip.first(30)
@@ -197,7 +200,7 @@ module ExportHelper
#毕设任务
tasks.each_with_index do |c,index|
- all_student_works = c.score_graduation_works #当前用户的对该作业的回答
+ all_student_works = c.score_graduation_works.select{|work| all_user_ids.include?(work.user_id)} #当前用户的对该作业的回答
title_no = count_1 + count_2 + count_3 + index.to_i + 1
graduation_work_to_xlsx(all_student_works,c,current_user)
work_name = format_sheet_name (title_no.to_s + "." + c.name).strip.first(30)
@@ -207,7 +210,7 @@ module ExportHelper
#试卷的导出
exercises.each_with_index do |c,index|
- all_student_works = c.score_exercise_users #当前用户的对该作业的回答
+ all_student_works = c.score_exercise_users.select{|work| all_user_ids.include?(work.user_id)} #当前用户的对该作业的回答
title_no = count_1 + count_2 + count_3 + count_4 + index.to_i + 1
get_export_users(c,course,all_student_works)
work_name = format_sheet_name (title_no.to_s + "." + c.exercise_name).strip.first(30)
From 77e3f5b46ac5997f9480e21bce2c76a0dc9fff52 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com>
Date: Thu, 12 Dec 2019 09:53:45 +0800
Subject: [PATCH 07/14] =?UTF-8?q?=E8=B0=83=E6=95=B4?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../Challenges/Challengesjupyter.js | 44 ++++++++++++-------
1 file changed, 29 insertions(+), 15 deletions(-)
diff --git a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js
index 86e7f2c04..2eb692f58 100644
--- a/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js
+++ b/public/react/src/modules/tpm/shixunchild/Challenges/Challengesjupyter.js
@@ -75,6 +75,16 @@ class Challengesjupyter extends Component {
}else{
console.log("componentDidMountChallengesjupyter");
console.log(response.data);
+ if(response.data.status===0){
+ this.setState({
+ jupyter_url:response.data.url,
+ jupyter_port:response.data.port,
+ })
+
+
+ }else{
+
+ }
}
}
}).catch((error) => {
@@ -142,9 +152,9 @@ class Challengesjupyter extends Component {
let id=this.props.match.params.shixunId;
var jupyter_port="";
try{
- jupyter_port= parseInt(propsysl.shixunsDetails.jupyter_port);
+ jupyter_port= parseInt(this.state.jupyter_port);
}catch (e) {
- jupyter_port=propsysl.shixunsDetails.jupyter_port;
+ jupyter_port=this.state.jupyter_port;
}
const url=`/shixuns/${id}/update_jupyter.json`;
@@ -242,13 +252,22 @@ class Challengesjupyter extends Component {
`
}
+ {
+ this.props.jupyter_url === null || this.props.jupyter_url === undefined ?
+ ""
+ :
+
+
+
+
this.modifyjupyter(this.props)}>
应用到实训
+
+
+ }
-
-
-
this.modifyjupyter(this.props)}>
应用到实训
-
*/}
-
- -
- 学习人数
- {shixunsDetails.stu_num}
-
- {/*- */}
- {/*经验值*/}
- {/*{shixunsDetails.experience}*/}
- {/*
*/}
- -
- 难度级别
- {shixunsDetails.diffcult}
-
-
+
+
+ {/**/}
+
+ -
+ 学习人数
+ {shixunsDetails.stu_num}
+
+ {/*- */}
+ {/*经验值*/}
+ {/*{shixunsDetails.experience}*/}
+ {/*
*/}
+ -
+ 难度级别
+ {shixunsDetails.diffcult}
+
+
-
+
正在等待管理员的审核。在审核通过前,可以随时撤销发布
+
-
- 正在等待管理员的审核。在审核通过前,可以随时撤销发布
-
-
- );
- }
+ );
+ }
}
export default TPMBanner;
diff --git a/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js b/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js
index 1e6980216..b72a4e43f 100644
--- a/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js
+++ b/public/react/src/modules/tpm/TPMsettings/Shixuninformation.js
@@ -64,6 +64,7 @@ class Shixuninformation extends Component {
choice_main_type:this.props.data.shixun.choice_main_type,
choice_small_type:this.props.data.shixun.choice_small_type,
choice_standard_scripts:this.props.data.shixun.choice_standard_scripts,
+ shixunmemoMDvalue:this.props.data.shixun.evaluate_script,
})
this.props.form.setFieldsValue({
@@ -316,7 +317,10 @@ class Shixuninformation extends Component {
let operateauthority=this.props.identity===1?true:this.props.identity<5&&this.props.data.shixun.status==0?true:false;
console.log(operateauthority)
const {getFieldDecorator} = this.props.form;
- const {newshixunlist, languagewrite, systemenvironment, testcoderunmode, fileList, choice_standard_scripts, postapplyvisible, shixunmemoMDvalue} = this.state;
+ const {languagewrite, systemenvironment, testcoderunmode, fileList, choice_standard_scripts, postapplyvisible, shixunmemoMDvalue} = this.state;
+
+ console.log("1222")
+ console.log(choice_standard_scripts)
const {shixun_service_configs}=this.props;
const uploadProps = {
width: 600,
@@ -478,6 +482,7 @@ class Shixuninformation extends Component {
})(
目前该实训项目尚在内测中,将于{shixunsmessage}之后开放,谢谢!
-*/} - {/*知道了*/} - {/*
*/} +目前该实训项目尚在内测中,将于{shixunsmessage}之后开放,谢谢!
+*/} + {/*知道了*/} + {/*
*/}实训已经更新了,正在为您重置!
+实训已经更新了,正在为您重置!
- 发布申请已提交,请等待管理员的审核
--
- 发布申请已提交,请等待管理员的审核
-- • 我们将在1-2个工作日内完成审核 -
- 第 - { - evaluation_set_position.map((item, key) => { - return ( - {item}, - ) - }) - } - 关评测设置尚未完成,无法申请发布 -
-- 每一个关卡至少需要一个技能标签
-- 第 - { - tag_position.map((item, key) => { - return ( - {item}, - ) - }) - } - 关尚未设置技能标签,请补充 -
- 尚未创建任务的实训,不能申请发布 -
-+ 发布申请已提交,请等待管理员的审核
++
+ 发布申请已提交,请等待管理员的审核
++ • 我们将在1-2个工作日内完成审核 +
+ 第 + { + evaluation_set_position.map((item, key) => { + return ( + {item}, + ) + }) + } + 关评测设置尚未完成,无法申请发布 +
++ 每一个关卡至少需要一个技能标签
++ 第 + { + tag_position.map((item, key) => { + return ( + {item}, + ) + }) + } + 关尚未设置技能标签,请补充 +
+ 尚未创建任务的实训,不能申请发布 +
+-
- {
- course_list === undefined ? "" : course_list.map((item, key) => {
- return (
- {item.name}
- )
- })
- }
-
-
-+
+ {
+ course_list === undefined ? "" : course_list.map((item, key) => {
+ return (
+ {item.name}
+ )
+ })
+ }
+
+
+复制将在后台执行,平台将为你创建
-一个新的同名实训和内容,请问是否继续?
复制将在后台执行,平台将为你创建
+一个新的同名实训和内容,请问是否继续?
{can_fork}
-请问是否前往进行认证?
{can_fork}
+请问是否前往进行认证?