chromesetting
杨树林 5 years ago
commit b23c32ab6d

@ -178,64 +178,70 @@ class ChallengesController < ApplicationController
# tab 0:过关任务的更新; 1:评测设置的更新; 2:表示参考答案的更新; # tab 0:过关任务的更新; 1:评测设置的更新; 2:表示参考答案的更新;
def update def update
ActiveRecord::Base.transaction do begin
tab = params[:tab].to_i ActiveRecord::Base.transaction do
@challenge.update_attributes(challenge_params) tab = params[:tab].to_i
if tab == 0 && @challenge.st == 0 @challenge.update_attributes(challenge_params)
@challenge.challenge_tags.delete_all if tab == 0 && @challenge.st == 0
if params[:challenge_tag].present? @challenge.challenge_tags.delete_all
params[:challenge_tag].each do |input| if params[:challenge_tag].present?
ChallengeTag.create!(:name => input, :challenge_id => @challenge.id) params[:challenge_tag].each do |input|
ChallengeTag.create!(:name => input, :challenge_id => @challenge.id)
end
end end
end elsif tab == 1
elsif tab == 1 path = @challenge.path
path = @challenge.path exec_path = @challenge.exec_path
exec_path = @challenge.exec_path test_set = @challenge.test_sets
test_set = @challenge.test_sets sets_output = test_set.map(&:output)
sets_output = test_set.map(&:output) sets_input = test_set.map(&:input)
sets_input = test_set.map(&:input) sets_open = test_set.map(&:is_public)
sets_open = test_set.map(&:is_public) set_score = test_set.map(&:score)
set_score = test_set.map(&:score) set_match_rule = test_set.map(&:match_rule)
set_match_rule = test_set.map(&:match_rule) params_hidden = params[:test_set].map{|set| set[:hidden].to_i == 0}
params_hidden = params[:test_set].map{|set| set[:hidden].to_i == 0} params_output = params[:test_set].map{|set| set[:output] }
params_output = params[:test_set].map{|set| set[:output] } params_input = params[:test_set].map{|set| set[:input] }
params_input = params[:test_set].map{|set| set[:input] } params_score = params[:test_set].map{|set| set[:score]}
params_score = params[:test_set].map{|set| set[:score]} params_test_set = params[:test_set].map{|set| set[:match_rule]}
params_test_set = params[:test_set].map{|set| set[:match_rule]} # 测试集变化则需要更新(输入、 输出、 是否隐藏)
# 测试集变化则需要更新(输入、 输出、 是否隐藏) if sets_output != params_output || sets_open != params_hidden || sets_input != params_input ||
if sets_output != params_output || sets_open != params_hidden || sets_input != params_input || set_score != params_score || params_test_set != set_match_rule
set_score != params_score || params_test_set != set_match_rule test_set.delete_all unless test_set.blank?
test_set.delete_all unless test_set.blank? params[:test_set].each_with_index do |set, index|
params[:test_set].each_with_index do |set, index| # last 末尾匹配, full: 全完匹配
# last 末尾匹配, full: 全完匹配 logger.info("set: #{set}; match_rule : #{set[:match_rule]}")
logger.info("set: #{set}; match_rule : #{set[:match_rule]}") match_rule = set[:match_rule] == 'last' ? 'last' : 'full'
match_rule = set[:match_rule] == 'last' ? 'last' : 'full' TestSet.create(:challenge_id => @challenge.id,
TestSet.create(:challenge_id => @challenge.id, :input => "#{set[:input]}",
:input => "#{set[:input]}", :output => "#{set[:output]}",
:output => "#{set[:output]}", :is_public => params_hidden[index],
:is_public => params_hidden[index], :score => set[:score],
:score => set[:score], :match_rule => "#{match_rule}",
:match_rule => "#{match_rule}", :position => (index + 1))
:position => (index + 1)) end
@challenge.update_column(:modify_time, Time.now)
# 测试集的
@shixun.myshixuns.update_all(:system_tip => 0)
end end
@challenge.update_column(:modify_time, Time.now) 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)
@shixun.myshixuns.update_all(:system_tip => 0) end
end # 关卡评测执行文件如果被修改,需要修改脚本内容
if params[:challenge][:show_type].to_i == -1 script = modify_shixun_script @shixun, @shixun.evaluate_script
@challenge.update_attributes(picture_path: nil, web_route: nil, expect_picture_path: nil, original_picture_path: nil) @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
# 关卡评测执行文件如果被修改,需要修改脚本内容
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
end end
# 参考答案的'增,删,改' # 参考答案的'增,删,改'

@ -163,9 +163,12 @@ module ExportHelper
count_2 = common_homeworks.size count_2 = common_homeworks.size
count_3 = group_homeworks.size count_3 = group_homeworks.size
count_4 = tasks.size count_4 = tasks.size
all_user_ids = all_members.pluck(:user_id)
#实训作业 #实训作业
shixun_homeworks.each_with_index do |s,index| 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 title_no = index.to_i + 1
student_work_to_xlsx(all_student_works,s) student_work_to_xlsx(all_student_works,s)
shixun_work_display_name = format_sheet_name (title_no.to_s + "." + s.name).strip.first(30) 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| 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 title_no = count_1 + index.to_i + 1
student_work_to_xlsx(all_student_works,c) student_work_to_xlsx(all_student_works,c)
@ -187,7 +190,7 @@ module ExportHelper
#分组作业 #分组作业
group_homeworks.each_with_index do |c,index| 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 title_no = count_1 + count_2 + index.to_i + 1
student_work_to_xlsx(all_student_works,c) student_work_to_xlsx(all_student_works,c)
work_name = format_sheet_name (title_no.to_s + "." + c.name).strip.first(30) 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| 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 title_no = count_1 + count_2 + count_3 + index.to_i + 1
graduation_work_to_xlsx(all_student_works,c,current_user) graduation_work_to_xlsx(all_student_works,c,current_user)
work_name = format_sheet_name (title_no.to_s + "." + c.name).strip.first(30) 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| 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 title_no = count_1 + count_2 + count_3 + count_4 + index.to_i + 1
get_export_users(c,course,all_student_works) get_export_users(c,course,all_student_works)
work_name = format_sheet_name (title_no.to_s + "." + c.exercise_name).strip.first(30) work_name = format_sheet_name (title_no.to_s + "." + c.exercise_name).strip.first(30)

@ -17,10 +17,17 @@ class SyncTrustieJob < ApplicationJob
"number": count "number": count
} }
uri = URI.parse(url) uri = URI.parse(url)
# http = Net::HTTP.new(uri.hostname, uri.port)
if api_host if api_host
http = Net::HTTP.new(uri.hostname, uri.port) 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 end
end end

@ -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

@ -89,12 +89,7 @@ export function initAxiosInterceptors(props) {
url = `${config.url}`; url = `${config.url}`;
} }
} }
//保存jupyter 到 tpm 中 //获取jupyter 到 tpm 中
if(config.params&&config.params.redirect_uri!=undefined){
if(config.params.redirect_uri.indexOf('/jupyters')!=-1){
url = `${config.url}`;
}
}
if(`${config[0]}`!=`true`){ if(`${config[0]}`!=`true`){
if (window.location.port === "3007") { if (window.location.port === "3007") {
// if (url.indexOf('.json') == -1) { // if (url.indexOf('.json') == -1) {

@ -38,9 +38,9 @@ class VNCContainer extends Component {
} }
shouldComponentUpdate () { // shouldComponentUpdate () {
return false; // return false;
} // }
getSecondDrawerWidth = () => { getSecondDrawerWidth = () => {
return $('#game_right_contents').width() - firstDrawerWidth return $('#game_right_contents').width() - firstDrawerWidth
@ -337,11 +337,11 @@ class VNCContainer extends Component {
width={firstDrawerWidth} width={firstDrawerWidth}
closable={false} closable={false}
onClose={this.onBottomDrawerClose} onClose={this.onBottomDrawerClose}
visible={this.state.bottomDrawer} visible={this.state.bottomDrawer===undefined?false:this.state.bottomDrawer}
className={'codeEvaluateDrawer'} className={'codeEvaluateDrawer'}
placement="bottom" placement="bottom"
getContainer={false} getContainer={false}
style={{ position: 'absolute', bottom: '25px', zIndex: 1 }} style={{ position: 'absolute', bottom: '-25px', zIndex: 1 }}
afterVisibleChange={(visible) => { afterVisibleChange={(visible) => {
if (visible) { if (visible) {
const canvas = $('.vncDisply canvas')[0] const canvas = $('.vncDisply canvas')[0]

File diff suppressed because it is too large Load Diff

@ -64,6 +64,7 @@ class Shixuninformation extends Component {
choice_main_type:this.props.data.shixun.choice_main_type, choice_main_type:this.props.data.shixun.choice_main_type,
choice_small_type:this.props.data.shixun.choice_small_type, choice_small_type:this.props.data.shixun.choice_small_type,
choice_standard_scripts:this.props.data.shixun.choice_standard_scripts, choice_standard_scripts:this.props.data.shixun.choice_standard_scripts,
shixunmemoMDvalue:this.props.data.shixun.evaluate_script,
}) })
this.props.form.setFieldsValue({ 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; let operateauthority=this.props.identity===1?true:this.props.identity<5&&this.props.data.shixun.status==0?true:false;
console.log(operateauthority) console.log(operateauthority)
const {getFieldDecorator} = this.props.form; 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 {shixun_service_configs}=this.props;
const uploadProps = { const uploadProps = {
width: 600, width: 600,
@ -478,6 +482,7 @@ class Shixuninformation extends Component {
})( })(
<div className=" fl pr mr20"> <div className=" fl pr mr20">
<Select placeholder="请选择小类别" <Select placeholder="请选择小类别"
mode="multiple"
onChange={this.selectright} onChange={this.selectright}
value={this.state.choice_small_type.length===0||this.state.choice_small_type[0]===""||this.state.choice_small_type===[]?undefined:this.state.choice_small_type} value={this.state.choice_small_type.length===0||this.state.choice_small_type[0]===""||this.state.choice_small_type===[]?undefined:this.state.choice_small_type}
style={{width: 180,height:30}} style={{width: 180,height:30}}

@ -99,7 +99,7 @@ export default class TPMsettings extends Component {
} }
</style> </style>
<Tabs tabBarExtraContent={ <Tabs tabBarExtraContent={
<div className={"mb20"}> <div className={"mb20 mr20"}>
<Button type="primary" ghost className={"Permanentban"}> <Button type="primary" ghost className={"Permanentban"}>
永久关闭 永久关闭
</Button> </Button>

@ -73,8 +73,8 @@ class Challengesjupyter extends Component {
if (response.data.status === 403||response.data.status === 401||response.data.status === 500) { if (response.data.status === 403||response.data.status === 401||response.data.status === 500) {
}else{ }else{
console.log("componentDidMountChallengesjupyter"); // console.log("componentDidMountChallengesjupyter");
console.log(response.data); // console.log(response.data);
if(response.data.status===0){ if(response.data.status===0){
this.setState({ this.setState({
jupyter_url:response.data.url, jupyter_url:response.data.url,

Loading…
Cancel
Save