From d75d507ab3cf1db86a99cf524b25d5b1d7f22478 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 6 Mar 2020 14:10:23 +0800 Subject: [PATCH 01/54] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E8=80=97=E6=97=B6?= =?UTF-8?q?=E4=B8=8D=E5=87=86=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/shixuns.rake | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 lib/tasks/shixuns.rake diff --git a/lib/tasks/shixuns.rake b/lib/tasks/shixuns.rake new file mode 100644 index 000000000..f2cdddc52 --- /dev/null +++ b/lib/tasks/shixuns.rake @@ -0,0 +1,18 @@ +#coding=utf-8 + + +desc "纠正学生实训耗时不准的问题" + +namespace :shixuns do + task correct_the_shixun_cost_time: :environment do + puts "myshixun_id: #{ENV['myshixun_id']}" + if ENV['myshixun_id'].present? + myshixun = Myshixun.find(ENV['myshixun_id']) + myshixun.games.where(status: 2).each do |game| + cost_time = game.open_time.to_i - game.end_time.to_i + game.update_column(:cost_time, cost_time) + end + end + + end +end \ No newline at end of file From bdb9e7b1ad1349237f1e864799b432ea7d82a53f Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 6 Mar 2020 14:18:53 +0800 Subject: [PATCH 02/54] =?UTF-8?q?=E8=BF=81=E7=A7=BB=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/shixuns.rake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/tasks/shixuns.rake b/lib/tasks/shixuns.rake index f2cdddc52..bca3d6db6 100644 --- a/lib/tasks/shixuns.rake +++ b/lib/tasks/shixuns.rake @@ -9,7 +9,11 @@ namespace :shixuns do if ENV['myshixun_id'].present? myshixun = Myshixun.find(ENV['myshixun_id']) myshixun.games.where(status: 2).each do |game| + puts "open_time: #{game.open_time.to_i}" + puts "end_time: #{game.end_time.to_i}" + puts "game_id: #{game.id}" cost_time = game.open_time.to_i - game.end_time.to_i + puts "cost_time: #{cost_time}" game.update_column(:cost_time, cost_time) end end From be87a6ec2f683315e9cac19c0bacff1d803744dd Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 6 Mar 2020 14:20:03 +0800 Subject: [PATCH 03/54] =?UTF-8?q?=E4=BF=AE=E6=AD=A3games=E7=9A=84=E8=80=97?= =?UTF-8?q?=E6=97=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/shixuns.rake | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/lib/tasks/shixuns.rake b/lib/tasks/shixuns.rake index bca3d6db6..0249c98f1 100644 --- a/lib/tasks/shixuns.rake +++ b/lib/tasks/shixuns.rake @@ -9,11 +9,7 @@ namespace :shixuns do if ENV['myshixun_id'].present? myshixun = Myshixun.find(ENV['myshixun_id']) myshixun.games.where(status: 2).each do |game| - puts "open_time: #{game.open_time.to_i}" - puts "end_time: #{game.end_time.to_i}" - puts "game_id: #{game.id}" - cost_time = game.open_time.to_i - game.end_time.to_i - puts "cost_time: #{cost_time}" + cost_time = game.end_time.to_i - game.open_time.to_i game.update_column(:cost_time, cost_time) end end From 90c030926ae9f0e5aa57d3ca00e09162f391a66d Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 6 Mar 2020 14:21:20 +0800 Subject: [PATCH 04/54] =?UTF-8?q?=E8=AF=84=E6=B5=8B=E8=80=97=E6=97=B6?= =?UTF-8?q?=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/shixuns.rake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/tasks/shixuns.rake b/lib/tasks/shixuns.rake index 0249c98f1..ce6d2b80d 100644 --- a/lib/tasks/shixuns.rake +++ b/lib/tasks/shixuns.rake @@ -9,7 +9,11 @@ namespace :shixuns do if ENV['myshixun_id'].present? myshixun = Myshixun.find(ENV['myshixun_id']) myshixun.games.where(status: 2).each do |game| + puts "open_time: #{game.open_time.to_i}" + puts "end_time: #{game.end_time.to_i}" + puts "game_id: #{game.id}" cost_time = game.end_time.to_i - game.open_time.to_i + puts "cost_time: #{cost_time}" game.update_column(:cost_time, cost_time) end end From 1e6381b256443c727ad480f984152fc94a98fc08 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 6 Mar 2020 14:24:09 +0800 Subject: [PATCH 05/54] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/shixuns.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/shixuns.rake b/lib/tasks/shixuns.rake index ce6d2b80d..28795a099 100644 --- a/lib/tasks/shixuns.rake +++ b/lib/tasks/shixuns.rake @@ -14,7 +14,7 @@ namespace :shixuns do puts "game_id: #{game.id}" cost_time = game.end_time.to_i - game.open_time.to_i puts "cost_time: #{cost_time}" - game.update_column(:cost_time, cost_time) + game.update_column!(:cost_time, cost_time) end end From 257aa29880ef37cf5526a449c7cf79f4404c0226 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 6 Mar 2020 14:25:11 +0800 Subject: [PATCH 06/54] =?UTF-8?q?=E6=9B=B4=E6=96=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/shixuns.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/shixuns.rake b/lib/tasks/shixuns.rake index 28795a099..84f8afd34 100644 --- a/lib/tasks/shixuns.rake +++ b/lib/tasks/shixuns.rake @@ -14,7 +14,7 @@ namespace :shixuns do puts "game_id: #{game.id}" cost_time = game.end_time.to_i - game.open_time.to_i puts "cost_time: #{cost_time}" - game.update_column!(:cost_time, cost_time) + game.update_attributes!(cost_time: cost_time) end end From 4e325346985b11d89e5308e30508b0b0e5b3cae1 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 6 Mar 2020 17:28:54 +0800 Subject: [PATCH 07/54] =?UTF-8?q?=E5=A4=9A=E8=BF=9B=E7=A8=8B=E4=BC=98?= =?UTF-8?q?=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/static_all.rake | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/tasks/static_all.rake b/lib/tasks/static_all.rake index 6deec5da1..2290f0dc5 100644 --- a/lib/tasks/static_all.rake +++ b/lib/tasks/static_all.rake @@ -3,8 +3,9 @@ desc "统计每个学校使用数据" namespace :static_all do task :repo => :environment do school_alls = School.includes(:courses, user_extensions: :user).all + proc_num = ENV['processes'].blank? ? 5 : ENV['processes'].to_i school_alls.find_in_batches(batch_size: 50) do |schools| - Parallel.each(schools, in_processes: 5) do |school| + Parallel.each(schools, in_processes: proc_num) do |school| puts("school_id: #{school.id}") data = Schools::SchoolStatisticService.new(school) sta_all = StaAll.find_or_initialize_by(school_id: school.id) From d6c003643fb4ca6b91ac27d2e0de1ac24b2d7f92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 6 Mar 2020 17:34:51 +0800 Subject: [PATCH 08/54] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/question/NewMyShixunModel.js | 63 +++++++++++++++---- public/react/src/modules/question/Question.js | 57 ++++++++++++++--- .../modules/question/component/Contentpart.js | 4 +- .../question/component/Contentquestionbank.js | 4 +- 4 files changed, 103 insertions(+), 25 deletions(-) diff --git a/public/react/src/modules/question/NewMyShixunModel.js b/public/react/src/modules/question/NewMyShixunModel.js index cce7be87d..4307c5ba2 100644 --- a/public/react/src/modules/question/NewMyShixunModel.js +++ b/public/react/src/modules/question/NewMyShixunModel.js @@ -729,7 +729,35 @@ class NewMyShixunModel extends Component { } - //选用 + + // 不选用 Question.js页面也有个 + NOgetitem_baskets=(data)=>{ + let url="/examination_banks/cancel_items.json"; + + axios.post(url, data) + .then((result) => { + if (result.data.status == 0) { + var data = { + discipline_id:this.state.discipline_id, + sub_discipline_id:this.state.sub_discipline_id, + tag_discipline_id:this.state.tag_discipline_id, + public: this.state.defaultActiveKey, + difficulty: this.state.difficulty, + item_type: this.state.item_type, + keyword: this.state.keywords, + page: this.state.page, + per_page:10, + exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id), + }; + this.getdatasy(data); + this.getbasket_listdata(); + } + }).catch((error) => { + ////console.log(error); + }) + } + + //选用 Question.js页面也有个 getitem_baskets=(data)=>{ //选用题型可以上传单个 或者多个题型 let url=""; @@ -743,7 +771,6 @@ class NewMyShixunModel extends Component { axios.post(url, data) .then((result) => { if (result.data.status == 0) { - // this.props.showNotification(`选用成功`); var data = { discipline_id:this.state.discipline_id, sub_discipline_id:this.state.sub_discipline_id, @@ -758,9 +785,6 @@ class NewMyShixunModel extends Component { }; this.getdatasy(data); this.getbasket_listdata(); - // this.setState({ - // visible:true - // }) } }).catch((error) => { ////console.log(error); @@ -845,7 +869,7 @@ class NewMyShixunModel extends Component { } //全选试题库 - selectallquestionsonthispage=()=>{ + selectallquestionsonthispage=(bool)=>{ var item_idsdata=[]; var arr= this.state.Contentdata.items; @@ -853,6 +877,10 @@ class NewMyShixunModel extends Component { if(data.item_type==="PROGRAM"){ //编程题 if(data.choosed===true){ + if(data.program_attr.status===1){ + //已发布 + item_idsdata.push(data.id); + } }else{ //未选用 @@ -866,7 +894,7 @@ class NewMyShixunModel extends Component { }else{ //不是编程题 if(data.choosed===true){ - + item_idsdata.push(data.id); }else{ //未选用 item_idsdata.push(data.id); @@ -878,10 +906,21 @@ class NewMyShixunModel extends Component { item_ids:item_idsdata, exam_id:this.props.exam_id===undefined?"":parseInt(this.props.exam_id), } - this.getitem_baskets(data); - this.setState({ - selectallquestionsonthispages:true, - }) + + + if(bool===false){ + this.getitem_baskets(data); + this.setState({ + selectallquestionsonthispages:true, + }) + }else{ + this.NOgetitem_baskets(data); + this.setState({ + selectallquestionsonthispages:false, + }) + } + + } //全选的状态 @@ -1040,7 +1079,7 @@ class NewMyShixunModel extends Component { chakanjiexiboolindex={this.state.chakanjiexiboolindex} chakanjiexibool={(e)=>this.chakanjiexibool(e)} getitem_basketss={(id)=>this.getitem_basketss(id)} - selectallquestionsonthispage={()=>this.selectallquestionsonthispage()} + selectallquestionsonthispage={(bool)=>this.selectallquestionsonthispage(bool)} getitem_baskets={(e)=>this.getitem_baskets(e)} setdatafuns={(e) => this.setdatafuns(e)} setdatafunsval={(e) => this.setdatafunsval(e)} diff --git a/public/react/src/modules/question/Question.js b/public/react/src/modules/question/Question.js index b48affa33..f4d859ed7 100644 --- a/public/react/src/modules/question/Question.js +++ b/public/react/src/modules/question/Question.js @@ -659,9 +659,37 @@ class Question extends Component { }) } + // 不选用 NewMyShixunModel.js 页面也有个 + NOgetitem_baskets=(data)=>{ + let url="/examination_banks/cancel_items.json"; + axios.post(url, data) + .then((result) => { + if (result.data.status == 0) { + // this.props.showNotification(`选用成功`); + var data = { + discipline_id:this.state.discipline_id, + sub_discipline_id:this.state.sub_discipline_id, + tag_discipline_id:this.state.tag_discipline_id, + public: this.state.defaultActiveKey, + difficulty: this.state.difficulty, + item_type: this.state.item_type, + keyword: this.state.keywords, + page: this.state.page, + per_page:10, + }; + this.getdatasy(data); + this.getbasket_listdata(); + // this.setState({ + // visible:true + // }) + } + }).catch((error) => { + ////console.log(error); + }) + } - //选用 + //选用 NewMyShixunModel.js 页面也有个 getitem_baskets=(data)=>{ //选用题型可以上传单个 或者多个题型 let url="/item_baskets.json"; @@ -738,7 +766,7 @@ class Question extends Component { } //全选试题库 - selectallquestionsonthispage=()=>{ + selectallquestionsonthispage=(bool)=>{ var item_idsdata=[]; var arr= this.state.Contentdata.items; @@ -746,7 +774,10 @@ class Question extends Component { if(data.item_type==="PROGRAM"){ //编程题 if(data.choosed===true){ - + if(data.program_attr.status===1){ + //已发布 + item_idsdata.push(data.id); + } }else{ //未选用 if(data.program_attr.status===1){ @@ -759,7 +790,7 @@ class Question extends Component { }else{ //不是编程题 if(data.choosed===true){ - + item_idsdata.push(data.id); }else{ //未选用 item_idsdata.push(data.id); @@ -770,10 +801,18 @@ class Question extends Component { const data={ item_ids:item_idsdata } - this.getitem_baskets(data); - this.setState({ - selectallquestionsonthispages:true, - }) + if(bool===false){ + this.getitem_baskets(data); + this.setState({ + selectallquestionsonthispages:true, + }) + }else{ + this.NOgetitem_baskets(data); + this.setState({ + selectallquestionsonthispages:false, + }) + } + } //全选的状态 @@ -1016,7 +1055,7 @@ class Question extends Component { chakanjiexiboolindex={this.state.chakanjiexiboolindex} chakanjiexibool={(e)=>this.chakanjiexibool(e)} getitem_basketss={(id)=>this.getitem_basketss(id)} - selectallquestionsonthispage={()=>this.selectallquestionsonthispage()} + selectallquestionsonthispage={(bool)=>this.selectallquestionsonthispage(bool)} getitem_baskets={(e)=>this.getitem_baskets(e)} setdatafuns={(e) => this.setdatafuns(e)} setdatafunsval={(e) => this.setdatafunsval(e)} diff --git a/public/react/src/modules/question/component/Contentpart.js b/public/react/src/modules/question/component/Contentpart.js index 955a9d9b8..516e6be1f 100644 --- a/public/react/src/modules/question/component/Contentpart.js +++ b/public/react/src/modules/question/component/Contentpart.js @@ -440,12 +440,12 @@ class Contentpart extends Component {
{ defaultActiveKey===1||defaultActiveKey==="1"? - this.props.selectallquestionsonthispage()} > + this.props.selectallquestionsonthispage(bool)} > :"" } { defaultActiveKey===0||defaultActiveKey==="0"? - this.props.selectallquestionsonthispage()}> + this.props.selectallquestionsonthispage(bool)}> :"" }
diff --git a/public/react/src/modules/question/component/Contentquestionbank.js b/public/react/src/modules/question/component/Contentquestionbank.js index 79e8bbb88..e6a724fef 100644 --- a/public/react/src/modules/question/component/Contentquestionbank.js +++ b/public/react/src/modules/question/component/Contentquestionbank.js @@ -50,9 +50,9 @@ class Contentquestionbank extends Component {
{ selectionbools===true? - this.props.selectallquestionsonthispage()} disabled> + this.props.selectallquestionsonthispage(this.props.selectallquestionsonthispages)} > : - this.props.selectallquestionsonthispage()}> + this.props.selectallquestionsonthispage(this.props.selectallquestionsonthispages)}> }

选用本页全部试题

From 12aed5dbf7bc24a1216ca8961cd73b3599303c1b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 6 Mar 2020 17:49:05 +0800 Subject: [PATCH 09/54] =?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/question/questioncss/questioncom.css | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/question/questioncss/questioncom.css b/public/react/src/modules/question/questioncss/questioncom.css index 3fee3fc1e..f2aeacef4 100644 --- a/public/react/src/modules/question/questioncss/questioncom.css +++ b/public/react/src/modules/question/questioncss/questioncom.css @@ -913,7 +913,7 @@ width: 40px !important; position: absolute; border-radius: 4px; - top: -50%; + top: -95%; } .shitikussmys{ width:29px !important; From 60b141c5ca0ef341dd0bf21bf18ddd79612d15e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 6 Mar 2020 18:02:53 +0800 Subject: [PATCH 10/54] =?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/question/Question.js | 30 +++++++++---------- .../question/questioncss/questioncom.css | 8 ++++- public/react/src/modules/tpm/TPMIndex.css | 2 +- 3 files changed, 23 insertions(+), 17 deletions(-) diff --git a/public/react/src/modules/question/Question.js b/public/react/src/modules/question/Question.js index f4d859ed7..9613a4cc3 100644 --- a/public/react/src/modules/question/Question.js +++ b/public/react/src/modules/question/Question.js @@ -1086,7 +1086,7 @@ class Question extends Component { { ` .ant-drawer-content-wrapper{ - width: 200px !important; + width: 160px !important; overflow:hidden; margin-top: 62px; } @@ -1134,8 +1134,8 @@ class Question extends Component { "" :

单选题{'('}{single_questions_count}{')'}

-

单选题{'('}{single_questions_count}{')'}

+

this.showQuestionModals("SINGLE")}>

} @@ -1145,8 +1145,8 @@ class Question extends Component { :

多选题{'('}{multiple_questions_count}{')'}

-

多选题{'('}{multiple_questions_count}{')'}

+

this.showQuestionModals("MULTIPLE")}>

} @@ -1156,8 +1156,8 @@ class Question extends Component { :

判断题{'('}{judgement_questions_count}{')'}

-

判断题{'('}{judgement_questions_count}{')'}

+

this.showQuestionModals("JUDGMENT")}>

} @@ -1167,8 +1167,8 @@ class Question extends Component { :

填空题{'('}{completion_questions_count}{')'}

-

填空题{'('}{completion_questions_count}{')'}

+

this.showQuestionModals("COMPLETION")}>

} @@ -1178,8 +1178,8 @@ class Question extends Component { :

简答题{'('}{subjective_questions_count}{')'}

-

简答题{'('}{subjective_questions_count}{')'}

+

this.showQuestionModals("SUBJECTIVE")}>

} @@ -1189,8 +1189,8 @@ class Question extends Component { :

实训题{'('}{practical_questions_count}{')'}

-

实训题{'('}{practical_questions_count}{')'}

+

} @@ -1200,8 +1200,8 @@ class Question extends Component { :

编程题{'('}{program_questions_count}{')'}

-

编程题{'('}{program_questions_count}{')'}

+

this.showQuestionModals("PROGRAM")}>

} diff --git a/public/react/src/modules/question/questioncss/questioncom.css b/public/react/src/modules/question/questioncss/questioncom.css index f2aeacef4..096b30007 100644 --- a/public/react/src/modules/question/questioncss/questioncom.css +++ b/public/react/src/modules/question/questioncss/questioncom.css @@ -271,6 +271,12 @@ width:30%; } +.w80s{ + width:80%; +} +.w20s{ + width:20%; +} .w50s{ width: 50%; @@ -913,7 +919,7 @@ width: 40px !important; position: absolute; border-radius: 4px; - top: -95%; + top: -79%; } .shitikussmys{ width:29px !important; diff --git a/public/react/src/modules/tpm/TPMIndex.css b/public/react/src/modules/tpm/TPMIndex.css index 4f19260aa..2ec090e7d 100644 --- a/public/react/src/modules/tpm/TPMIndex.css +++ b/public/react/src/modules/tpm/TPMIndex.css @@ -268,7 +268,7 @@ body>.-task-title { background: #EEEEEE; } .mystask-sidebar{ - right: 220px !important; + right: 181px !important; } .mystask-sidebars{ right: 20px !important; From 29ea294271aa456fa4c76bfc315fe11cf57a6414 Mon Sep 17 00:00:00 2001 From: dinglink <837816638@qq.com> Date: Fri, 6 Mar 2020 18:11:16 +0800 Subject: [PATCH 11/54] =?UTF-8?q?=E8=A7=A3=E5=86=B3=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E8=BF=94=E5=9B=9E=E5=80=BC=E4=B8=8D=E5=AF=B9?= =?UTF-8?q?=E7=9A=84bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- et --hard 8e0cf37 | 274 ++++++++++++++++++ .../react/src/modules/paths/statics/index.js | 1 + public/react/src/redux/actions/static.js | 3 +- 3 files changed, 276 insertions(+), 2 deletions(-) create mode 100644 et --hard 8e0cf37 diff --git a/et --hard 8e0cf37 b/et --hard 8e0cf37 new file mode 100644 index 000000000..95a171a18 --- /dev/null +++ b/et --hard 8e0cf37 @@ -0,0 +1,274 @@ +commit 8e0cf3730ba50f5fb95773d7ed3bfeab51cff640 (HEAD -> forge) +Author: dingyongkang <837816638@qq.com> +Date: Tue Feb 25 17:14:50 2020 +0800 + + 合并请求模块 + +commit b0d10c14dd86c0db5bfa37da24587687e7570b60 +Merge: ba41688b4 8a3afcbf0 +Author: dingyongkang <837816638@qq.com> +Date: Wed Feb 19 20:02:46 2020 +0800 + + 工单模块 + +commit ba41688b4b6116d677585a826e53ee0a7c3c3f7d +Author: dingyongkang <837816638@qq.com> +Date: Wed Feb 19 19:33:48 2020 +0800 + + 工单部分 + +commit 8a3afcbf00835d67725ea9464b9abac16eb2a89c +Merge: 57415df2a 30ef541d4 +Author: sylor_huang@126.com +Date: Wed Feb 19 19:12:18 2020 +0800 + + Merge branch 'forge' of https://bdgit.educoder.net/Hjqreturn/educoder into forge + +commit 57415df2aa48aebc0b29a3d4725a06dcdb63d742 +Author: sylor_huang@126.com +Date: Wed Feb 19 19:11:50 2020 +0800 + + issue的问题修复及pull_request的问题修复 + +commit 30ef541d40a1c7063a20423e3b95c73da8e9bf8c +Merge: 21ce82e9c ded428147 +Author: caicai8 <1149225589@qq.com> +Date: Wed Feb 19 17:38:45 2020 +0800 + + Merge branch 'forge' of https://bdgit.educoder.net/Hjqreturn/educoder into forge + +commit 21ce82e9c15724fc3b10c02ab3d0b5ed6670e86e +Author: caicai8 <1149225589@qq.com> +Date: Wed Feb 19 17:38:41 2020 +0800 + + 动态列表 + +commit ded4281470613992a416be8b383e863136e2cd81 +Author: sylor_huang@126.com +Date: Wed Feb 19 17:30:53 2020 +0800 + + 修改csv的乱码问题 + +commit a5a5add7d662377ebd0a8b3796b761f043232f4a +Merge: d4132a802 b435933a5 +Author: sylor_huang@126.com +Date: Wed Feb 19 15:12:01 2020 +0800 + + Merge branch 'forge' of https://bdgit.educoder.net/Hjqreturn/educoder into forge + +commit d4132a802e5afa2d5f79d4540827348b8395edb1 +Author: sylor_huang@126.com +Date: Wed Feb 19 15:10:56 2020 +0800 + + 分支切换添加loading + +commit b435933a54709da3ab4e167d1657348cea359de1 +Author: caicai8 <1149225589@qq.com> +Date: Wed Feb 19 15:04:46 2020 +0800 + + 动态-分页 + +commit b10091130e3bea8ff989ccd018505d19eb4dec29 +Merge: 92fea708c 0d060af2f +Author: caicai8 <1149225589@qq.com> +Date: Wed Feb 19 11:59:48 2020 +0800 + + Merge branch 'forge' of https://bdgit.educoder.net/Hjqreturn/educoder into forge + +commit 92fea708c48a27cd2fddb7ebb096dddc248129ca +Author: caicai8 <1149225589@qq.com> +Date: Wed Feb 19 11:59:45 2020 +0800 + + 文件 + +commit a93837a062dacec33a277d50f504de9bf037f687 +Author: caicai8 <1149225589@qq.com> +Date: Wed Feb 19 11:59:35 2020 +0800 + + 动态 + +commit 0d060af2f926dc92482a76346abfc94d09cd32d1 +Author: sylor_huang@126.com +Date: Tue Feb 18 18:43:56 2020 +0800 + + 前端bug修复和后端问题 + +commit 42e8a78477525c32d98d2299c3826f0dc4f6e38f +Merge: 64d920039 d9e89e6fb +Author: sylor_huang@126.com +Date: Tue Feb 18 16:16:49 2020 +0800 + + Merge branch 'forge' of https://bdgit.educoder.net/Hjqreturn/educoder into forge + +commit 64d920039a51196fff20b813938969e3c326e1c6 +Author: sylor_huang@126.com +Date: Tue Feb 18 16:16:24 2020 +0800 + + 一些bug修改 + +commit d9e89e6fb7934d9e215dc1e7c7d1f61093154b9a +Author: caicai8 <1149225589@qq.com> +Date: Tue Feb 18 16:12:18 2020 +0800 + + branch + +commit 43e9c90439890056c94a2265296bda2626aef447 +Author: caicai8 <1149225589@qq.com> +Date: Tue Feb 18 14:56:09 2020 +0800 + + 从分支页面跳转到分支提交页面 + +commit 2e42ad82cafa3c3a96813e517253d825dddf8e27 +Merge: 9a2dd0456 d3a9af7bb +Author: caicai8 <1149225589@qq.com> +Date: Tue Feb 18 13:34:48 2020 +0800 + + Merge branch 'forge' of https://bdgit.educoder.net/Hjqreturn/educoder into forge + +commit 9a2dd0456eb2e25490d697ad539ac0ccf7a047cf +Author: caicai8 <1149225589@qq.com> +Date: Tue Feb 18 13:34:43 2020 +0800 + + package + +commit d3a9af7bb3b4e0600f5bb7a26a349fe87eb49bc5 +Author: sylor_huang@126.com +Date: Tue Feb 18 10:54:38 2020 +0800 + + 前端样式修改 + +commit 5feb1f6e53b325822d305bbfcd4a6c644d9039dd +Author: caicai8 <1149225589@qq.com> +Date: Mon Feb 17 16:38:53 2020 +0800 + + clone_url + +commit 2eefb0ed381211ec250470202e686c2465807c7d +Author: sylor_huang@126.com +Date: Fri Feb 14 19:03:58 2020 +0800 + + 前端部分修改 + +commit 9990e3b5c50aa0c9a2c1e9f7442fa85208fa6211 +Merge: 0f97b2edd 6a41049e1 +Author: sylor_huang@126.com +Date: Fri Feb 14 14:46:52 2020 +0800 + + Merge branch 'forge' of https://bdgit.educoder.net/Hjqreturn/educoder into forge + +commit 0f97b2eddae2551be9c155adf318d800f5dd8e58 +Author: sylor_huang@126.com +Date: Fri Feb 14 14:46:17 2020 +0800 + + 前端样式修复 + +commit 6a41049e1de36eda58d728e7eba2285db2ac68fa +Author: Jasder <2053003901@@qq.com> +Date: Thu Feb 13 22:48:40 2020 +0800 + + ADD some count + +commit 36860fe5c2995331e87d6437c48cacd9155f3a16 +Merge: 1f2a0c0e6 00cb5c061 +Author: Jasder <2053003901@@qq.com> +Date: Thu Feb 13 22:44:17 2020 +0800 + + Merge branch 'forge' of http://bdgit.educoder.net/Hjqreturn/educoder into forge + +commit 00cb5c0610f63eae6d4139a9cf1c536f5e048833 +Author: sylor_huang@126.com +Date: Thu Feb 13 18:53:01 2020 +0800 + + 修改entry的错误 + +commit 1f2a0c0e61ad320d6c54de0721c46c02677c43b6 +Merge: a72b4f682 5a8fcf994 +Author: Jasder <2053003901@@qq.com> +Date: Thu Feb 13 18:51:14 2020 +0800 + + fic bug + +commit 5a8fcf994fcce0829e620cb5dd507de93606ee33 +Author: sylor_huang@126.com +Date: Thu Feb 13 18:09:10 2020 +0800 + + 修改 + +commit a72b4f68276babbf6c65ea877266af4251ba3410 +Merge: 9a2ff48de 36ccf249b +Author: Jasder <2053003901@@qq.com> +Date: Thu Feb 13 18:01:51 2020 +0800 + + FIC merge bug + +commit 9a2ff48de8c3a3f9f9958489bbe235b1f72319f7 +Author: Jasder <2053003901@@qq.com> +Date: Thu Feb 13 17:59:20 2020 +0800 + + FIX 404 page bug + +commit 36ccf249bf68542b4b9324d89c478789db12887b +Author: sylor_huang@126.com +Date: Thu Feb 13 17:53:16 2020 +0800 + + 注释current_laboratory + +commit adc7da1a3c541ed263daf8793bdb9af1e736900c +Author: sylor_huang@126.com +Date: Thu Feb 13 17:47:49 2020 +0800 + + 修改appconfig.js + +commit 6e6649aa096921a994bed0119eafc288d5ac5a29 +Author: sylor_huang@126.com +Date: Thu Feb 13 17:40:39 2020 +0800 + + 注释get_user_info里的current_laboratory + +commit a447a0d10229275ad6c51903762c2175b2afb743 +Author: sylor_huang@126.com +Date: Thu Feb 13 17:23:57 2020 +0800 + + change current_laboratory is nill error + +commit 567d20caea58782d1e99058cb76fb1e1307f7b09 +Merge: d66c0c2f3 0408f89cb +Author: sylor_huang@126.com +Date: Thu Feb 13 17:15:29 2020 +0800 + + Merge branch 'forge' of https://bdgit.educoder.net/Hjqreturn/educoder into forge + +commit d66c0c2f31b717ed3fed6bcff74318a682768635 +Author: sylor_huang@126.com +Date: Thu Feb 13 17:14:59 2020 +0800 + + 修改settings/show.json + +commit 0408f89cb37041a92deea969619873849198d99c +Merge: ef807c8ec 8933a1a91 +Author: Jasder <2053003901@@qq.com> +Date: Thu Feb 13 17:12:02 2020 +0800 + + Merge branch 'forge' of http://bdgit.educoder.net/Hjqreturn/educoder into forge + +commit ef807c8ecfc5fd5f1129d6ab4d2f1a6c16333dbd +Author: Jasder <2053003901@@qq.com> +Date: Thu Feb 13 17:10:23 2020 +0800 + + ADD 工单,pull_requests 数据统计 + +commit 8933a1a916baa4805ac45c1970542d25a447f703 +Author: sylor_huang@126.com +Date: Thu Feb 13 16:45:27 2020 +0800 + + build + +commit 05266a3c3ff2e03573337965c4580d7cc771e4fb +Author: sylor_huang@126.com +Date: Thu Feb 13 16:33:23 2020 +0800 + + issue标签和里程碑 + +commit e2550b9d741835e1e59eed25a17e004d62dd0919 +Author: dingyongkang <837816638@qq.com> +Date: T \ No newline at end of file diff --git a/public/react/src/modules/paths/statics/index.js b/public/react/src/modules/paths/statics/index.js index 6b14f118c..aa5592cd4 100644 --- a/public/react/src/modules/paths/statics/index.js +++ b/public/react/src/modules/paths/statics/index.js @@ -249,6 +249,7 @@ const App = (props) => { // 恢复初始值 changeParams(params); initTotal(); + console.log(staticList) pathId && staticList(pathId); } diff --git a/public/react/src/redux/actions/static.js b/public/react/src/redux/actions/static.js index 3159d35c2..bc689c868 100644 --- a/public/react/src/redux/actions/static.js +++ b/public/react/src/redux/actions/static.js @@ -12,8 +12,7 @@ import { fetchStaticList } from "../../services/staticService"; export const staticList = (id) => { return (dispatch, getState) => { const { params, total_count, other_info } = getState().staticReducer; - - if (total_count !== 0 && total_count === other_info.length) return; + if (other_info.length===20||total_count !== 0 && total_count === other_info.length) return; fetchStaticList(id, params).then(res => { // console.log('统计数据=====>>>>>', res); const {data} = res; From 8fb1e9c372f51170b6763b5f20ab4044191c9465 Mon Sep 17 00:00:00 2001 From: caicai8 <1149225589@qq.com> Date: Fri, 6 Mar 2020 18:17:42 +0800 Subject: [PATCH 12/54] issue --- .../courses/coursesDetail/CoursesLeftNav.js | 17 +++++++--------- .../courses/coursesPublic/Addcourses.js | 15 ++++++++++---- .../src/modules/courses/new/CoursesNew.js | 20 +++++++++---------- .../RepositoryAddFileupload_file.js | 19 ++++++++++++++---- 4 files changed, 43 insertions(+), 28 deletions(-) diff --git a/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js b/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js index 80c250134..999ae4e15 100644 --- a/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js +++ b/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js @@ -499,7 +499,6 @@ class Coursesleftnav extends Component{ } cannerNavmoda=()=>{ - this.setState({ Navmodalnametype:false, NavmodalValuetype:false, @@ -525,6 +524,7 @@ class Coursesleftnav extends Component{ } saveNavmodapost=(url,value,positiontype,coursesId)=>{ + axios.post(url, {name:value}).then((result)=>{ if(result!=undefined){ @@ -539,13 +539,13 @@ class Coursesleftnav extends Component{ if(positiontype==="files"){ this.updasaveNavmoda() trigger('updateNavSuccess') - window.location.href=`/courses/${coursesId}/file/${result.data.category_id}`; + this.props.history.push(`/courses/${coursesId}/file/${result.data.category_id}`); } if(positiontype==="boards"){ this.updasaveNavmoda() trigger('updateNavSuccess') - window.location.href=`/courses/${coursesId}/boards/${result.data.category_id}`; + this.props.history.push(`/courses/${coursesId}/boards/${result.data.category_id}`); } if(positiontype!="course_groups"){ @@ -585,7 +585,6 @@ class Coursesleftnav extends Component{ } saveNavmoda=()=>{ - debugger; let {Navmodaltypename,setnavid,NavmodalValue}=this.state; let id =setnavid; @@ -950,17 +949,15 @@ class Coursesleftnav extends Component{ {/* ""*/} {/*}*/} - { - Navmodalnametype===true?:"" - } + { + debugger; let{Addcoursestype}=this.state; this.setState({ isSpin:true }) let {invite_code,professor,assistant_professor,student}=this.state; + invite_code="MBTAP"; if(invite_code===undefined||invite_code===""){ this.setState({ invite_codetype:true, @@ -269,13 +271,18 @@ class Addcourses extends Component{ this.props.history.push('/courses/2704/boards/8367/messages/42072') return; } - if(response.data.course_id!=undefined){ - this.submitasyn(response.data.course_id) - } notification.open({ message:"提示", description:response.data.message - }); + }); + if(response.data.course_id!=undefined){ + this.submitasyn(response.data.course_id) + }else{ + // 无返回课程id则是选择的教师或者助教身份,成功后跳转到课堂首页 + // console.log(this.props); + // console.log(this.props.history.push); + window.location.href="/courses"; + } if(Addcoursestype===true){ this.props.hideAddcoursestype(); } diff --git a/public/react/src/modules/courses/new/CoursesNew.js b/public/react/src/modules/courses/new/CoursesNew.js index 873b1d9d7..e599bfa93 100644 --- a/public/react/src/modules/courses/new/CoursesNew.js +++ b/public/react/src/modules/courses/new/CoursesNew.js @@ -73,8 +73,8 @@ class CoursesNew extends Component { period: data.class_period===undefined?'':data.class_period===null?'':data.class_period===null?'':data.class_period==="null"?'':data.class_period+"", credit: data.credit===undefined?'':data.credit===null?'':data.credit===null?'':data.credit==="null"?'':data.credit+"", checkboxgroup: data.course_module_types, - Realnamecertification: data.authentication, - Professionalcertification:data.professional_certification, + // Realnamecertification: data.authentication, + // Professionalcertification:data.professional_certification, endtime: data.end_date === undefined ? "" : moment(data.end_date, dateFormat), school:data.school @@ -84,8 +84,8 @@ class CoursesNew extends Component { datatime: data.end_date, dataname:data.name, is_public: data.is_public === 1 ? true : false, - Realnamecertification: data.authentication, - Professionalcertification:data.professional_certification, + // Realnamecertification: data.authentication, + // Professionalcertification:data.professional_certification, addonAfteronelenone: data.class_period===undefined?'':data.class_period===null?'':data.class_period===null?'':data.class_period==="null"?'':data.class_period, addonAfteronelentwo:data.credit===undefined?'':data.credit===null?'':data.credit===null?'':data.credit==="null"?'':data.credit, @@ -237,8 +237,8 @@ class CoursesNew extends Component { end_date: datatime===undefined?"":datatime, is_public: is_public === true || is_public === 1 ? 1 : 0, course_module_types: values.checkboxgroup, - authentication: this.state.Realnamecertification, - professional_certification: this.state.Professionalcertification, + // authentication: this.state.Realnamecertification, + // professional_certification: this.state.Professionalcertification, school:values.school } ).then((response) => { @@ -313,8 +313,8 @@ class CoursesNew extends Component { end_date: datatime===undefined?"":datatime, is_public: is_public === true || is_public === 1 ? 1 : 0, course_module_types: values.checkboxgroup, - authentication: this.state.Realnamecertification, - professional_certification: this.state.Professionalcertification, + // authentication: this.state.Realnamecertification, + // professional_certification: this.state.Professionalcertification, school:values.school } ).then((response) => { @@ -953,7 +953,7 @@ class CoursesNew extends Component { )}
-
+ {/*
-
+
*/}
{ + if(info.response){ let shixunId = this.props.match.params.shixunId; let {message,filspath}=this.state; if(message===""||message===undefined){ @@ -105,13 +109,20 @@ class RepositoryAddFileupload_files extends Component { secret_repository:Repositoryflag }}) .then((response) => { - if (response.data.status == 0) { - this.props.showNotification("删除成功") + if (response.data.status === 0) { + let fileList = this.state.fileList.filter(item=>item.uid !== info.uid); + this.setState({ + fileList + }) + this.props.showNotification("删除成功"); } }) .catch(function (error) { console.log(error); }); + }else{ + this.props.showNotification("还未上传完成,无法进行删除操作!"); + } } FormInput=(e)=>{ @@ -195,7 +206,7 @@ class RepositoryAddFileupload_files extends Component { return false } - this.props.showNotification("上传成功") + // this.props.showNotification("上传成功"); }, }; From f614c99827291c79988081da2a76559b1edb46a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 6 Mar 2020 19:38:26 +0800 Subject: [PATCH 13/54] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/testpaper/Intecomponents.js | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/public/react/src/modules/testpaper/Intecomponents.js b/public/react/src/modules/testpaper/Intecomponents.js index 8776b6a9e..ce5040821 100644 --- a/public/react/src/modules/testpaper/Intecomponents.js +++ b/public/react/src/modules/testpaper/Intecomponents.js @@ -282,6 +282,34 @@ class Intecomponents extends Component { } preservation = () => { + + let mylistcour=1; + try { + mylistcour=this.state.single_question_count+this.state.multiple_question_count+this.state.judgement_question_count+this.state.program_question_count + }catch (e) { + + } + if(mylistcour===0){ + this.props.showNotification(`没有题不能组卷`); + return; + } + + let arraycour=1; + try { + arraycour=this.Judquestio.Getdatas()[3].rbdxt+this.Judquestio.Getdatas()[4].rbdxtx+ this.Judquestio.Getdatas()[5].rbpdt+this.Judquestio.Getdatas()[6].rbbct + + }catch (e) { + + } + + if(arraycour===0){ + this.props.showNotification(`没有设置题型及数量不能组卷`); + return; + } + + + + if (this.Judquestio.Getdatas().length === 0) { this.scrollToAnchor("Itembankstopid"); return; From 9daef0475ff10ed7033a056bca504123b4da7690 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 6 Mar 2020 19:39:43 +0800 Subject: [PATCH 14/54] =?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/tpm/NewHeader.js | 30 +++++++++++------------ 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index dccdbc5a7..8d3c85378 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -1075,21 +1075,21 @@ submittojoinclass=(value)=>{ ` } - { - Periofters===true? -
  • - -
    -
    - 题库 -
    -
    -
    -
  • - :"" - } + {/*{*/} + {/* Periofters===true?*/} + {/*
  • */} + {/* */} + {/*
    */} + {/*
    */} + {/* 题库*/} + {/*
    */} + {/*
    */} + {/*
    */} + {/*
  • */} + {/* :""*/} + {/*}*/}
  • Date: Fri, 6 Mar 2020 20:04:35 +0800 Subject: [PATCH 15/54] issue --- .../react/src/modules/courses/boards/index.js | 10 ++-- .../courses/coursesPublic/Addcourses.js | 2 - .../RepositoryAddFileupload_file.js | 46 +++++++++---------- 3 files changed, 28 insertions(+), 30 deletions(-) diff --git a/public/react/src/modules/courses/boards/index.js b/public/react/src/modules/courses/boards/index.js index ea49e862b..9c18313fe 100644 --- a/public/react/src/modules/courses/boards/index.js +++ b/public/react/src/modules/courses/boards/index.js @@ -98,12 +98,12 @@ class Boards extends Component{ this.fetchBoards() this.fetchAll() - on('updateNavSuccess', this.updateNavSuccess) + // on('updateNavSuccess', this.updateNavSuccess) } - componentWillUnmount() { - off('updateNavSuccess', this.updateNavSuccess) - } + // componentWillUnmount() { + // off('updateNavSuccess', this.updateNavSuccess) + // } updateNavSuccess = () => { this.fetchBoards() if (this.props.match.params.boardId == this.state.boardid) { @@ -112,7 +112,7 @@ class Boards extends Component{ } componentDidUpdate = (prevProps) => { - if ( prevProps.match.params.boardId != this.props.match.params.boardId ) { + if ( prevProps.match.params.boardId !== this.props.match.params.boardId ) { this.setState({ isSpin:true }) diff --git a/public/react/src/modules/courses/coursesPublic/Addcourses.js b/public/react/src/modules/courses/coursesPublic/Addcourses.js index ab26787ea..fb0a8a920 100644 --- a/public/react/src/modules/courses/coursesPublic/Addcourses.js +++ b/public/react/src/modules/courses/coursesPublic/Addcourses.js @@ -194,13 +194,11 @@ class Addcourses extends Component{ } submittojoinclass=()=>{ - debugger; let{Addcoursestype}=this.state; this.setState({ isSpin:true }) let {invite_code,professor,assistant_professor,student}=this.state; - invite_code="MBTAP"; if(invite_code===undefined||invite_code===""){ this.setState({ invite_codetype:true, diff --git a/public/react/src/modules/tpm/shixunchild/Repository/RepositoryAddFileupload_file.js b/public/react/src/modules/tpm/shixunchild/Repository/RepositoryAddFileupload_file.js index 71161bb89..eb0557472 100644 --- a/public/react/src/modules/tpm/shixunchild/Repository/RepositoryAddFileupload_file.js +++ b/public/react/src/modules/tpm/shixunchild/Repository/RepositoryAddFileupload_file.js @@ -65,7 +65,6 @@ class RepositoryAddFileupload_files extends Component { fileList = fileList.map(file => { if (file.response) { if (file.response.status===0) { - } } return file; @@ -76,34 +75,35 @@ class RepositoryAddFileupload_files extends Component { }; onAttachmentRemove=(info)=>{ + console.log(info); if(info.response){ - let shixunId = this.props.match.params.shixunId; - let {message,filspath}=this.state; - if(message===""||message===undefined){ - this.props.showNotification('删除文件请先填写提交信息'); - return - } + let shixunId = this.props.match.params.shixunId; + let {message,filspath}=this.state; + if(message===""||message===undefined){ + this.props.showNotification('删除文件请先填写提交信息'); + return; + } - let matchpath =this.props.match.path; + let matchpath =this.props.match.path; - let Repositoryflag =undefined; + let Repositoryflag =undefined; - if( matchpath.indexOf("repository")>-1){ - Repositoryflag =undefined; - } - if(matchpath.indexOf("secret_repository")>-1){ - Repositoryflag =true; - } + if( matchpath.indexOf("repository")>-1){ + Repositoryflag =undefined; + } + if(matchpath.indexOf("secret_repository")>-1){ + Repositoryflag =true; + } - let newfilspath=filspath; + let newfilspath=filspath; - if(newfilspath===""){ - newfilspath=info.name - }else{ - newfilspath=filspath+"/"+info.name - } - const url = `/shixuns//${shixunId}/delete_git_file.json`; - axios.delete(url, { data: { + if(newfilspath===""){ + newfilspath=info.name + }else{ + newfilspath=filspath+"/"+info.name + } + const url = `/shixuns//${shixunId}/delete_git_file.json`; + axios.delete(url, { data: { path:newfilspath, message:message, secret_repository:Repositoryflag From 760c2edfddaba7770828c0d65097abd9be26aba0 Mon Sep 17 00:00:00 2001 From: dinglink <837816638@qq.com> Date: Fri, 6 Mar 2020 20:31:36 +0800 Subject: [PATCH 16/54] =?UTF-8?q?=E7=BB=9F=E8=AE=A1=E9=A1=B5=E9=9D=A2?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E5=80=BC=E4=BC=9A=E5=8F=A0=E5=8A=A0=E5=8F=8A?= =?UTF-8?q?=E8=BF=94=E5=9B=9E=E5=80=BC=E4=BC=9A=E6=8D=A2=E6=88=90=E5=9C=A8?= =?UTF-8?q?=E5=8F=A6=E5=A4=96=E4=B8=80=E4=B8=AA=E8=AF=BE=E5=A0=82=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E4=B8=8D=E5=AF=B9=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/paths/statics/index.js | 10 ++++++---- public/react/src/redux/actions/static.js | 4 +++- public/react/src/redux/reducers/staticReducer.js | 4 +++- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/public/react/src/modules/paths/statics/index.js b/public/react/src/modules/paths/statics/index.js index aa5592cd4..b4eeec035 100644 --- a/public/react/src/modules/paths/statics/index.js +++ b/public/react/src/modules/paths/statics/index.js @@ -23,7 +23,7 @@ const App = (props) => { total, staticList, changeParams, - initTotal + initTotal, } = props; // const [datas, setDatas] = useState([]); // const [sortedInfo, setSortedInfo] = useState({}); @@ -212,7 +212,8 @@ const App = (props) => { sorter: (a, b) => a.cost_time - b.cost_time } ]; - + + useEffect(() => { changeParams({ page: 1 @@ -224,6 +225,7 @@ const App = (props) => { pathId && staticList(pathId); } + // const { // study_count, // course_study_count, @@ -249,7 +251,6 @@ const App = (props) => { // 恢复初始值 changeParams(params); initTotal(); - console.log(staticList) pathId && staticList(pathId); } @@ -335,8 +336,9 @@ const mapStateToProps = (state) => { return { subject_info, other_info, - total + total, } + }; const mapDispatchToProps = (dispatch) => ({ diff --git a/public/react/src/redux/actions/static.js b/public/react/src/redux/actions/static.js index bc689c868..77c4e0267 100644 --- a/public/react/src/redux/actions/static.js +++ b/public/react/src/redux/actions/static.js @@ -12,13 +12,15 @@ import { fetchStaticList } from "../../services/staticService"; export const staticList = (id) => { return (dispatch, getState) => { const { params, total_count, other_info } = getState().staticReducer; - if (other_info.length===20||total_count !== 0 && total_count === other_info.length) return; + // console.log('统计数据=====>>>>>', params); + // if (total_count !== 0 && total_count === other_info.length) return; fetchStaticList(id, params).then(res => { // console.log('统计数据=====>>>>>', res); const {data} = res; if (data.status === 0) { dispatch({ type: types.GET_STATIC_INFO, + other_info:data.data.other_info, payload: data.data }); } diff --git a/public/react/src/redux/reducers/staticReducer.js b/public/react/src/redux/reducers/staticReducer.js index 7d2202d03..3790b2638 100644 --- a/public/react/src/redux/reducers/staticReducer.js +++ b/public/react/src/redux/reducers/staticReducer.js @@ -38,12 +38,14 @@ const initalState = { const staticReducer = (state = initalState, action) => { const { payload = {}, type } = action; const {subject_info, other_info = [], total = {}, total_count} = payload; + switch (type) { case types.GET_STATIC_INFO: return { ...state, subject_info, - other_info: state.other_info.concat(other_info), + other_info, + // other_info: state.other_info.concat(other_info), total, total_count, params: Object.assign({}, state.params, { page: state.params.page + 1 }) From 2de1014d4b65f7acddf25c3122b0450ded195b27 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 6 Mar 2020 20:47:38 +0800 Subject: [PATCH 17/54] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../homework_commons_controller.rb | 1084 ++++++++--------- 1 file changed, 515 insertions(+), 569 deletions(-) diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index d4e7ae4a3..415207707 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -58,7 +58,7 @@ class HomeworkCommonsController < ApplicationController end @published_count = @user_course_identity < Course::STUDENT ? @homework_commons.homework_published.size : - @homework_commons.size + @homework_commons.size unless search.blank? @homework_commons = @homework_commons.where("homework_commons.name like ?", "%#{search}%") @@ -110,7 +110,7 @@ class HomeworkCommonsController < ApplicationController if @homework_type == 4 @homework_commons = @homework_commons.includes(:homework_detail_manual, :published_settings, :homework_group_settings, :shixuns, :course_second_category, user: :user_extension) elsif @homework_type == 3 - @homework_commons = @homework_commons.includes(:homework_detail_manual, :published_settings, :homework_group_settings, :homework_detail_group, :course_second_category, user: :user_extension) + @homework_commons = @homework_commons.includes(:homework_detail_manual, :published_settings, :homework_group_settings, :homework_detail_group, :course_second_category, user: :user_extension) else @homework_commons = @homework_commons.includes(:homework_detail_manual, :published_settings, :homework_group_settings, :course_second_category, user: :user_extension) end @@ -128,7 +128,7 @@ class HomeworkCommonsController < ApplicationController if @homework.publish_time.blank? || (@homework.publish_time > Time.now) @student_works = [] if (params[:format] == "xlsx") || (params[:format] == "zip") - normal_status(-1,"作业未发布") + normal_status(-1, "作业未发布") end else if @user_course_identity == Course::STUDENT @@ -145,14 +145,14 @@ class HomeworkCommonsController < ApplicationController # 学生已提交作品且补交(提交)已截止、作品公开、非匿评阶段 if @work&.work_status.to_i > 0 && (@homework.work_public || @homework.score_open) && - ((!@homework.anonymous_comment && @homework.end_or_late) || (@homework_detail_manual.comment_status > 4 && @homework.end_or_late)) + ((!@homework.anonymous_comment && @homework.end_or_late) || (@homework_detail_manual.comment_status > 4 && @homework.end_or_late)) @student_works = student_works.where("student_works.user_id != #{@work.user_id}") # 匿评、申诉阶段只能看到分配给自己的匿评作品 elsif @work&.work_status.to_i > 0 && @homework.anonymous_comment && @homework_detail_manual.comment_status > 2 && @homework_detail_manual.comment_status <= 4 @is_evaluation = true @student_works = student_works.joins(:student_works_evaluation_distributions).where( - "student_works_evaluation_distributions.user_id = #{@current_user.id}") + "student_works_evaluation_distributions.user_id = #{@current_user.id}") else @student_works = [] end @@ -173,7 +173,7 @@ class HomeworkCommonsController < ApplicationController unless params[:teacher_comment].blank? student_work_ids = StudentWorksScore.where(student_work_id: @student_works.map(&:id)).pluck(:student_work_id) if params[:teacher_comment].to_i == 0 - @student_works = @student_works.where.not(id: student_work_ids) + @student_works = @student_works.where.not(id: student_work_ids) elsif params[:teacher_comment].to_i == 1 @student_works = @student_works.where(id: student_work_ids) end @@ -182,7 +182,7 @@ class HomeworkCommonsController < ApplicationController # 作品状态 0: 未提交, 1 按时提交, 2 延迟提交 if params[:work_status].present? params_work_status = params[:work_status] - work_status = params_work_status.map{|status| status.to_i} + work_status = params_work_status.map {|status| status.to_i} if @homework.homework_type == "practice" @student_works = @student_works.where(compelete_status: work_status) else @@ -241,17 +241,17 @@ class HomeworkCommonsController < ApplicationController if @user_course_identity >= Course::STUDENT tip_exception(403, "无权限操作") elsif @work_excel.blank? || @work_excel.size == 0 - normal_status(-1,"暂无用户提交!") + normal_status(-1, "暂无用户提交!") elsif params[:export].present? && params[:export] - normal_status(0,"正在下载中") + normal_status(0, "正在下载中") else respond_to do |format| - format.xlsx{ + format.xlsx { set_export_cookies - student_work_to_xlsx(@work_excel,@homework) + student_work_to_xlsx(@work_excel, @homework) exercise_export_name = "#{current_user.real_name}_#{@course.name}_#{@homework.name}_#{Time.now.strftime('%Y%m%d_%H%M%S')}" - render xlsx: "#{exercise_export_name.strip}",template: "homework_commons/works_list.xlsx.axlsx",locals: - {table_columns: @work_head_cells,task_users: @work_cells_column} + render xlsx: "#{exercise_export_name.strip}", template: "homework_commons/works_list.xlsx.axlsx", locals: + {table_columns: @work_head_cells, task_users: @work_cells_column} } end end @@ -268,10 +268,10 @@ class HomeworkCommonsController < ApplicationController if status == 0 if params[:export].present? && params[:export] - normal_status(0,"正在下载中") + normal_status(0, "正在下载中") else respond_to do |format| - format.zip{ + format.zip { set_export_cookies zipfile = zip_homework_common @homework, zip_works file = decode64(zipfile[0][:base64file]) @@ -289,33 +289,21 @@ class HomeworkCommonsController < ApplicationController def update_score tip_exception("作业还未发布,暂不能计算成绩") if @homework.publish_time.nil? || @homework.publish_time > Time.now - begin - @homework.update_homework_work_score - normal_status("更新成功") - rescue Exception => e - uid_logger(e.message) - tip_exception(e.message) - raise ActiveRecord::Rollback - end + @homework.update_homework_work_score + normal_status("更新成功") end def update_student_score work = @homework.student_works.find_by(user_id: current_user.id) myshixun = Myshixun.find_by(shixun_id: params[:shixun_id], user_id: current_user.id) ActiveRecord::Base.transaction do - begin - if work && myshixun - challenge_settings = @homework.homework_challenge_settings - games = myshixun.games.where(challenge_id: challenge_settings.pluck(:challenge_id)) - HomeworksService.new.update_myshixun_work_score work, myshixun, games, @homework, challenge_settings - normal_status("更新成功") - else - normal_status("还未开启挑战,暂不能更新成绩") - end - rescue Exception => e - uid_logger(e.message) - tip_exception(e.message) - raise ActiveRecord::Rollback + if work && myshixun + challenge_settings = @homework.homework_challenge_settings + games = myshixun.games.where(challenge_id: challenge_settings.pluck(:challenge_id)) + HomeworksService.new.update_myshixun_work_score work, myshixun, games, @homework, challenge_settings + normal_status("更新成功") + else + normal_status("还未开启挑战,暂不能更新成绩") end end end @@ -382,41 +370,35 @@ class HomeworkCommonsController < ApplicationController end ActiveRecord::Base.transaction do - begin - @homework = HomeworkCommon.new(homework_params) - @homework.reference_answer = params[:reference_answer].to_s.strip - @homework.homework_type = @homework_type - @homework.user_id = current_user.id - @homework.course_id = @course.id - - homework_detail_manual = HomeworkDetailManual.new - @homework.homework_detail_manual = homework_detail_manual - homework_detail_manual.te_proportion = 0.7 - homework_detail_manual.ta_proportion = 0.3 - - if @homework_type == 3 - homework_detail_group = HomeworkDetailGroup.new(min_num: params[:min_num].to_i, max_num: params[:max_num].to_i, - base_on_project: params[:base_on_project]) - @homework.homework_detail_group = homework_detail_group - end + @homework = HomeworkCommon.new(homework_params) + @homework.reference_answer = params[:reference_answer].to_s.strip + @homework.homework_type = @homework_type + @homework.user_id = current_user.id + @homework.course_id = @course.id + + homework_detail_manual = HomeworkDetailManual.new + @homework.homework_detail_manual = homework_detail_manual + homework_detail_manual.te_proportion = 0.7 + homework_detail_manual.ta_proportion = 0.3 + + if @homework_type == 3 + homework_detail_group = HomeworkDetailGroup.new(min_num: params[:min_num].to_i, max_num: params[:max_num].to_i, + base_on_project: params[:base_on_project]) + @homework.homework_detail_group = homework_detail_group + end - if @homework.save! - homework_detail_manual.save! if homework_detail_manual - homework_detail_group.save! if homework_detail_group + if @homework.save! + homework_detail_manual.save! if homework_detail_manual + homework_detail_group.save! if homework_detail_group - # 作业描述的附件 - Attachment.associate_container(params[:attachment_ids], @homework.id, @homework.class) if params[:attachment_ids] - # 作业参考答案的附件 - Attachment.associate_container(params[:reference_attachment_ids], @homework.id, @homework.class, 2) if params[:reference_attachment_ids] + # 作业描述的附件 + Attachment.associate_container(params[:attachment_ids], @homework.id, @homework.class) if params[:attachment_ids] + # 作业参考答案的附件 + Attachment.associate_container(params[:reference_attachment_ids], @homework.id, @homework.class, 2) if params[:reference_attachment_ids] - HomeworksService.new.create_works_list(@homework, @course) - else - tip_exception("创建失败") - end - rescue Exception => e - uid_logger(e.message) - tip_exception(e.message) - raise ActiveRecord::Rollback + HomeworksService.new.create_works_list(@homework, @course) + else + tip_exception("创建失败") end end end @@ -432,30 +414,25 @@ class HomeworkCommonsController < ApplicationController end ActiveRecord::Base.transaction do - begin - @homework.update_attributes!(homework_params) - @homework.reference_answer = params[:reference_answer].to_s.strip - - if @homework.homework_type == "group" - homework_detail_group = @homework.homework_detail_group - param_min = params[:min_num].to_i - param_max = params[:max_num].to_i - homework_detail_group.min_num = @homework.has_commit_work ? [param_min, homework_detail_group.min_num].min : param_min - homework_detail_group.max_num = @homework.has_commit_work ? [param_max, homework_detail_group.max_num].max : param_max - homework_detail_group.base_on_project = params[:base_on_project] unless @homework.has_relate_project - homework_detail_group.save! - end - # 作业描述的附件 - Attachment.associate_container(params[:attachment_ids], @homework.id, @homework.class) if params[:attachment_ids] - # 作业参考答案的附件 - Attachment.associate_container(params[:reference_attachment_ids], @homework.id, @homework.class, 2) if params[:reference_attachment_ids] - - normal_status(0, "更新成功") - rescue Exception => e - uid_logger(e.message) - tip_exception(e.message) - raise ActiveRecord::Rollback + @homework.update_attributes!(homework_params) + @homework.reference_answer = params[:reference_answer].to_s.strip + + if @homework.homework_type == "group" + homework_detail_group = @homework.homework_detail_group + param_min = params[:min_num].to_i + param_max = params[:max_num].to_i + homework_detail_group.min_num = @homework.has_commit_work ? [param_min, homework_detail_group.min_num].min : param_min + homework_detail_group.max_num = @homework.has_commit_work ? [param_max, homework_detail_group.max_num].max : param_max + homework_detail_group.base_on_project = params[:base_on_project] unless @homework.has_relate_project + homework_detail_group.save! end + # 作业描述的附件 + Attachment.associate_container(params[:attachment_ids], @homework.id, @homework.class) if params[:attachment_ids] + # 作业参考答案的附件 + Attachment.associate_container(params[:reference_attachment_ids], @homework.id, @homework.class, 2) if params[:reference_attachment_ids] + + normal_status(0, "更新成功") + end end @@ -467,304 +444,298 @@ class HomeworkCommonsController < ApplicationController end def update_settings - begin - # 课堂结束后不能再更新 - unless @course.is_end - - # 发布设置 - UpdateHomeworkPublishSettingService.call(@homework, publish_params) - - # 补交设置 - tip_exception("缺少allow_late参数") if params[:allow_late].nil? - tip_exception("缺少late_penalty参数") if params[:allow_late] && params[:late_penalty].blank? - tip_exception("缺少late_time参数") if params[:allow_late] && params[:late_time].blank? - - current_late_penalty = @homework.late_penalty - if params[:allow_late] - tip_exception("补交结束时间必须晚于截止时间") if params[:late_time] <= strf_time(@homework.end_time) - tip_exception("补交结束时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if @course.end_date.present? && params[:late_time] > - strf_time(@course.end_date.end_of_day) - tip_exception("迟交扣分不能小于0") if params[:late_penalty] && params[:late_penalty].to_i < 0 + # 课堂结束后不能再更新 + unless @course.is_end + + # 发布设置 + UpdateHomeworkPublishSettingService.call(@homework, publish_params) + + # 补交设置 + tip_exception("缺少allow_late参数") if params[:allow_late].nil? + tip_exception("缺少late_penalty参数") if params[:allow_late] && params[:late_penalty].blank? + tip_exception("缺少late_time参数") if params[:allow_late] && params[:late_time].blank? + + current_late_penalty = @homework.late_penalty + if params[:allow_late] + tip_exception("补交结束时间必须晚于截止时间") if params[:late_time] <= strf_time(@homework.end_time) + tip_exception("补交结束时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if @course.end_date.present? && params[:late_time] > + strf_time(@course.end_date.end_of_day) + tip_exception("迟交扣分不能小于0") if params[:late_penalty] && params[:late_penalty].to_i < 0 + + @homework.allow_late = true + @homework.late_time = params[:late_time] + @homework.late_penalty = params[:late_penalty].to_i + else + @homework.allow_late = false + @homework.late_penalty = 0 + @homework.late_time = nil + end - @homework.allow_late = true - @homework.late_time = params[:late_time] - @homework.late_penalty = params[:late_penalty].to_i - else - @homework.allow_late = false - @homework.late_penalty = 0 - @homework.late_time = nil + # 迟交扣分有变动则更新迟交学生的成绩 + late_penalty_change = @homework.late_penalty != current_late_penalty + + if @homework.homework_type == "practice" + + # 实训作业的评分设置 + tip_exception("总分值不能为空") if params[:total_score].blank? + tip_exception("总分值不能小于0") if params[:total_score].to_i < 0 + tip_exception("缺少answer_open_evaluation参数") if params[:answer_open_evaluation].nil? + tip_exception("缺少work_efficiency参数") if params[:work_efficiency].nil? + tip_exception("缺少eff_score参数") if params[:work_efficiency] && params[:eff_score].blank? + tip_exception("效率分不能小于等于0") if params[:work_efficiency] && params[:eff_score] && params[:eff_score].to_f <= 0 + tip_exception("效率分不能大于总分值") if params[:work_efficiency] && params[:eff_score] && params[:eff_score].to_f.round(2) > params[:total_score].to_f.round(2) + tip_exception("缺少shixun_evaluation参数") if params[:shixun_evaluation].blank? + tip_exception("缺少challenge_settings参数") if params[:challenge_settings].blank? + # tip_exception("缺少challenge_id参数") if params[:challenge_settings][:challenge_id].blank? + # tip_exception("缺少challenge_score参数") if params[:challenge_settings][:challenge_score].blank? + # tip_exception("challenge_id参数的长度与challenge_score参数的长度不匹配") if + # params[:challenge_settings][:challenge_score].length != params[:challenge_settings][:challenge_id].length + + sum_challenge_score = params[:challenge_settings].pluck(:challenge_score).reject(&:blank?)&.map {|score| score.to_f}.sum + total_score = params[:work_efficiency] ? (params[:eff_score].to_f + sum_challenge_score) : sum_challenge_score + tip_exception("分值之和必须等于总分值:#{params[:total_score]}分") if params[:total_score].to_f.round(2) != total_score.to_f.round(2) + + current_eff_score = @homework.eff_score.to_f.round(2) + @homework.total_score = params[:total_score] + @homework.work_efficiency = params[:work_efficiency] + @homework.eff_score = params[:work_efficiency] ? params[:eff_score].to_f.round(2) : 0 + + update_eff_score = current_eff_score.round(2) != @homework.eff_score.round(2) + + if @homework_detail_manual.answer_open_evaluation != params[:answer_open_evaluation] + @homework_detail_manual.answer_open_evaluation = params[:answer_open_evaluation] + score_change = true end - # 迟交扣分有变动则更新迟交学生的成绩 - late_penalty_change = @homework.late_penalty != current_late_penalty - - if @homework.homework_type == "practice" - - # 实训作业的评分设置 - tip_exception("总分值不能为空") if params[:total_score].blank? - tip_exception("总分值不能小于0") if params[:total_score].to_i < 0 - tip_exception("缺少answer_open_evaluation参数") if params[:answer_open_evaluation].nil? - tip_exception("缺少work_efficiency参数") if params[:work_efficiency].nil? - tip_exception("缺少eff_score参数") if params[:work_efficiency] && params[:eff_score].blank? - tip_exception("效率分不能小于等于0") if params[:work_efficiency] && params[:eff_score] && params[:eff_score].to_f <= 0 - tip_exception("效率分不能大于总分值") if params[:work_efficiency] && params[:eff_score] && params[:eff_score].to_f.round(2) > params[:total_score].to_f.round(2) - tip_exception("缺少shixun_evaluation参数") if params[:shixun_evaluation].blank? - tip_exception("缺少challenge_settings参数") if params[:challenge_settings].blank? - # tip_exception("缺少challenge_id参数") if params[:challenge_settings][:challenge_id].blank? - # tip_exception("缺少challenge_score参数") if params[:challenge_settings][:challenge_score].blank? - # tip_exception("challenge_id参数的长度与challenge_score参数的长度不匹配") if - # params[:challenge_settings][:challenge_score].length != params[:challenge_settings][:challenge_id].length - - sum_challenge_score = params[:challenge_settings].pluck(:challenge_score).reject(&:blank?)&.map{|score| score.to_f}.sum - total_score = params[:work_efficiency] ? (params[:eff_score].to_f + sum_challenge_score) : sum_challenge_score - tip_exception("分值之和必须等于总分值:#{params[:total_score]}分") if params[:total_score].to_f.round(2) != total_score.to_f.round(2) - - current_eff_score = @homework.eff_score.to_f.round(2) - @homework.total_score = params[:total_score] - @homework.work_efficiency = params[:work_efficiency] - @homework.eff_score = params[:work_efficiency] ? params[:eff_score].to_f.round(2) : 0 - - update_eff_score = current_eff_score.round(2) != @homework.eff_score.round(2) - - if @homework_detail_manual.answer_open_evaluation != params[:answer_open_evaluation] - @homework_detail_manual.answer_open_evaluation = params[:answer_open_evaluation] - score_change = true - end - - @homework_detail_manual.shixun_evaluation = params[:shixun_evaluation].to_i - - if params[:challenge_settings] - params[:challenge_settings].each do |challenge| - setting = @homework.homework_challenge_settings.find_by(challenge_id: challenge[:challenge_id]) - score = challenge[:challenge_score] - if setting && setting.score != score - score_change = true - setting.update_attributes!(score: score) - elsif setting.blank? - score_change = true - HomeworkChallengeSetting.create!(homework_common_id: @homework.id, challenge_id: challenge[:challenge_id], - shixun_id: @homework.homework_commons_shixun.try(:shixun_id), score: score) - end - end + @homework_detail_manual.shixun_evaluation = params[:shixun_evaluation].to_i - if @homework.homework_challenge_settings.where.not(challenge_id: params[:challenge_settings].pluck(:challenge_id)).count > 0 + if params[:challenge_settings] + params[:challenge_settings].each do |challenge| + setting = @homework.homework_challenge_settings.find_by(challenge_id: challenge[:challenge_id]) + score = challenge[:challenge_score] + if setting && setting.score != score score_change = true - @homework.homework_challenge_settings.where.not(challenge_id: params[:challenge_settings].pluck(:challenge_id)).destroy_all + setting.update_attributes!(score: score) + elsif setting.blank? + score_change = true + HomeworkChallengeSetting.create!(homework_common_id: @homework.id, challenge_id: challenge[:challenge_id], + shixun_id: @homework.homework_commons_shixun.try(:shixun_id), score: score) end end - # 公开设置 - tip_exception("缺少score_open参数") if params[:score_open].nil? - @homework.score_open = params[:score_open] - - @homework.save! - if score_change && @homework.end_or_late_none_group - UpdateShixunWorkScoreJob.perform_later(@homework.id) - elsif update_eff_score && (@homework.end_or_late_none_group || @homework.max_efficiency > 0) - # 更新所有学生的效率分(作业允许补交且补交已截止 或者 作业不允许补交且提交已截止 或者作业已计算过效率分) - HomeworksService.new.update_student_eff_score HomeworkCommon.find_by(id: @homework.id) + if @homework.homework_challenge_settings.where.not(challenge_id: params[:challenge_settings].pluck(:challenge_id)).count > 0 + score_change = true + @homework.homework_challenge_settings.where.not(challenge_id: params[:challenge_settings].pluck(:challenge_id)).destroy_all end + end - # 更新迟交扣分 - if !(score_change || update_eff_score) && late_penalty_change - @homework.student_works.where(work_status: 2).each do |work| - work.late_penalty = @homework.late_penalty - work.save! - end - end + # 公开设置 + tip_exception("缺少score_open参数") if params[:score_open].nil? + @homework.score_open = params[:score_open] - unless @homework.allow_late - @homework.student_works.where(work_status: 2).update_all(work_status: 1) - end + @homework.save! + if score_change && @homework.end_or_late_none_group + UpdateShixunWorkScoreJob.perform_later(@homework.id) + elsif update_eff_score && (@homework.end_or_late_none_group || @homework.max_efficiency > 0) + # 更新所有学生的效率分(作业允许补交且补交已截止 或者 作业不允许补交且提交已截止 或者作业已计算过效率分) + HomeworksService.new.update_student_eff_score HomeworkCommon.find_by(id: @homework.id) + end - @homework_detail_manual.save! - @homework.save! - else + # 更新迟交扣分 + if !(score_change || update_eff_score) && late_penalty_change + @homework.student_works.where(work_status: 2).each do |work| + work.late_penalty = @homework.late_penalty + work.save! + end + end - # 普通和分组作业的匿评设置 - current_absence_penalty = @homework_detail_manual.absence_penalty - current_appeal_penalty = @homework_detail_manual.appeal_penalty - - # 匿评未开启前可以更新:是否开启匿评、匿评开始时间、匿评数 - if @homework_detail_manual.comment_status < 3 - tip_exception("缺少anonymous_comment参数") if params[:anonymous_comment].nil? - # anonymous_comment :true 是启用,false 是不启用 - if params[:anonymous_comment] - tip_exception("匿评开启时间不能为空") if params[:evaluation_start].blank? - tip_exception("匿评开启时间不能早于截止时间") if params[:evaluation_start] < strf_time(@homework.end_time) - tip_exception("匿评结束时间不能为空") if params[:evaluation_end].blank? - tip_exception("匿评截止时间必须晚于匿评开启时间") if params[:evaluation_end] <= params[:evaluation_start] - tip_exception("匿评截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if @course.end_date.present? && params[:evaluation_end] > - strf_time(@course.end_date.end_of_day) - tip_exception("匿评数必须为正整数") if params[:evaluation_num].blank? || params[:evaluation_num].to_i < 1 - tip_exception("缺评扣分不能为空") if params[:absence_penalty].blank? - tip_exception("缺评扣分不能小于0") if params[:absence_penalty].to_i < 0 - tip_exception("缺评扣分不能大于100") if params[:absence_penalty].to_i > 100 - end + unless @homework.allow_late + @homework.student_works.where(work_status: 2).update_all(work_status: 1) + end - @homework.anonymous_comment = params[:anonymous_comment] - @homework_detail_manual.evaluation_start = !@homework.anonymous_comment ? nil : params[:evaluation_start] - @homework_detail_manual.evaluation_num = !@homework.anonymous_comment ? 0 : params[:evaluation_num] - - # 不启用匿评时还原申诉设置和教师、助教的评分比例 - unless @homework.anonymous_comment - @homework.anonymous_appeal = false - @homework_detail_manual.appeal_time = nil - @homework_detail_manual.appeal_penalty = 0 - @homework_detail_manual.te_proportion = 1 - @homework_detail_manual.ta_proportion = 0 - end + @homework_detail_manual.save! + @homework.save! + else + # 普通和分组作业的匿评设置 + current_absence_penalty = @homework_detail_manual.absence_penalty + current_appeal_penalty = @homework_detail_manual.appeal_penalty + + # 匿评未开启前可以更新:是否开启匿评、匿评开始时间、匿评数 + if @homework_detail_manual.comment_status < 3 + tip_exception("缺少anonymous_comment参数") if params[:anonymous_comment].nil? + # anonymous_comment :true 是启用,false 是不启用 + if params[:anonymous_comment] + tip_exception("匿评开启时间不能为空") if params[:evaluation_start].blank? + tip_exception("匿评开启时间不能早于截止时间") if params[:evaluation_start] < strf_time(@homework.end_time) + tip_exception("匿评结束时间不能为空") if params[:evaluation_end].blank? + tip_exception("匿评截止时间必须晚于匿评开启时间") if params[:evaluation_end] <= params[:evaluation_start] + tip_exception("匿评截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if @course.end_date.present? && params[:evaluation_end] > + strf_time(@course.end_date.end_of_day) + tip_exception("匿评数必须为正整数") if params[:evaluation_num].blank? || params[:evaluation_num].to_i < 1 + tip_exception("缺评扣分不能为空") if params[:absence_penalty].blank? + tip_exception("缺评扣分不能小于0") if params[:absence_penalty].to_i < 0 + tip_exception("缺评扣分不能大于100") if params[:absence_penalty].to_i > 100 end - # 匿评未截止时可以更新匿评结束时间 - if @homework_detail_manual.comment_status < 4 - tip_exception("匿评结束时间不能为空") if @homework.anonymous_comment && params[:evaluation_end].blank? - tip_exception("匿评截止时间必须晚于匿评开启时间") if @homework.anonymous_comment && - params[:evaluation_end] <= strf_time(@homework_detail_manual.evaluation_start) - tip_exception("匿评截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if @homework.anonymous_comment && - @course.end_date.present? && params[:evaluation_end] > strf_time(@course.end_date.end_of_day) + @homework.anonymous_comment = params[:anonymous_comment] + @homework_detail_manual.evaluation_start = !@homework.anonymous_comment ? nil : params[:evaluation_start] + @homework_detail_manual.evaluation_num = !@homework.anonymous_comment ? 0 : params[:evaluation_num] - @homework_detail_manual.evaluation_end = !@homework.anonymous_comment ? nil : params[:evaluation_end] + # 不启用匿评时还原申诉设置和教师、助教的评分比例 + unless @homework.anonymous_comment + @homework.anonymous_appeal = false + @homework_detail_manual.appeal_time = nil + @homework_detail_manual.appeal_penalty = 0 + @homework_detail_manual.te_proportion = 1 + @homework_detail_manual.ta_proportion = 0 end - # 作业未结束可以更新缺评扣分 - tip_exception("缺评扣分不能为空") if @homework.anonymous_comment && params[:absence_penalty].blank? - tip_exception("缺评扣分不能小于0") if @homework.anonymous_comment && params[:absence_penalty].to_i < 0 - tip_exception("缺评扣分不能大于100") if @homework.anonymous_comment && params[:absence_penalty].to_i > 100 - @homework_detail_manual.absence_penalty = !@homework.anonymous_comment ? 0 : params[:absence_penalty].to_i + end + # 匿评未截止时可以更新匿评结束时间 + if @homework_detail_manual.comment_status < 4 + tip_exception("匿评结束时间不能为空") if @homework.anonymous_comment && params[:evaluation_end].blank? + tip_exception("匿评截止时间必须晚于匿评开启时间") if @homework.anonymous_comment && + params[:evaluation_end] <= strf_time(@homework_detail_manual.evaluation_start) + tip_exception("匿评截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if @homework.anonymous_comment && + @course.end_date.present? && params[:evaluation_end] > strf_time(@course.end_date.end_of_day) - # 匿评申诉设置 - # 匿评申诉未开启前可以更新:是否启用匿评申诉 - if @homework_detail_manual.comment_status < 4 && @homework.anonymous_comment - tip_exception("缺少anonymous_appeal参数") if params[:anonymous_appeal].nil? - @homework.anonymous_appeal = params[:anonymous_appeal] - end + @homework_detail_manual.evaluation_end = !@homework.anonymous_comment ? nil : params[:evaluation_end] + end + # 作业未结束可以更新缺评扣分 + tip_exception("缺评扣分不能为空") if @homework.anonymous_comment && params[:absence_penalty].blank? + tip_exception("缺评扣分不能小于0") if @homework.anonymous_comment && params[:absence_penalty].to_i < 0 + tip_exception("缺评扣分不能大于100") if @homework.anonymous_comment && params[:absence_penalty].to_i > 100 + @homework_detail_manual.absence_penalty = !@homework.anonymous_comment ? 0 : params[:absence_penalty].to_i - # 匿评申诉未结束前可以更新:匿评申诉结束时间 - if @homework_detail_manual.comment_status < 5 - tip_exception("匿评申诉结束时间不能为空") if @homework.anonymous_appeal && params[:appeal_time].blank? - tip_exception("匿评开启时间不能早于匿评截止时间") if @homework.anonymous_appeal && - params[:appeal_time] <= strf_time(@homework_detail_manual.evaluation_end) - tip_exception("匿评申诉结束不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if @homework.anonymous_appeal && - @course.end_date.present? && params[:appeal_time] > strf_time(@course.end_date.end_of_day) - @homework_detail_manual.appeal_time = @homework.anonymous_appeal ? params[:appeal_time] : nil - end + # 匿评申诉设置 + # 匿评申诉未开启前可以更新:是否启用匿评申诉 + if @homework_detail_manual.comment_status < 4 && @homework.anonymous_comment + tip_exception("缺少anonymous_appeal参数") if params[:anonymous_appeal].nil? + @homework.anonymous_appeal = params[:anonymous_appeal] + end - # 作业未结束可以更新违规匿评扣分 - tip_exception("违规匿评扣分不能为空") if @homework.anonymous_appeal && params[:appeal_penalty].blank? - tip_exception("违规匿评扣分不能小于0") if @homework.anonymous_appeal && params[:appeal_penalty].to_i < 0 - tip_exception("违规匿评扣分不能大于100") if @homework.anonymous_appeal && params[:appeal_penalty].to_i > 100 - @homework_detail_manual.appeal_penalty = @homework.anonymous_appeal ? params[:appeal_penalty].to_i : 0 - - # 如果缺评扣分的设置有变更且匿评已截止 - absence_penalty_change = current_absence_penalty != @homework_detail_manual.absence_penalty && - @homework_detail_manual.comment_status >= 4 - # 如果违规匿评扣分的设置有变更且匿评已截止 - appeal_penalty_change = current_appeal_penalty != @homework_detail_manual.appeal_penalty && - @homework_detail_manual.comment_status >= 4 - - # 评分设置 - tip_exception("助教评分模式不能为空") if params[:ta_mode].blank? - - # 助教评分模式的变更 - ta_mode_change = @homework_detail_manual.ta_mode != params[:ta_mode].to_i - @homework_detail_manual.ta_mode = params[:ta_mode].to_i - - # 最终成绩组成 - tip_exception("最终成绩组成模式不能为空") if params[:final_mode].nil? - - final_mode_change = @homework_detail_manual.final_mode != params[:final_mode] - @homework_detail_manual.final_mode = params[:final_mode] - if !@homework_detail_manual.final_mode - tip_exception("教师评分比例不能为空") if params[:te_proportion].blank? - te_proportion = params[:te_proportion].to_f.round(2) - tip_exception("教师评分比例不能小于0") if te_proportion < 0 - tip_exception("助教评分比例不能为空") if params[:ta_proportion].blank? - ta_proportion = params[:ta_proportion].to_f.round(2) - tip_exception("助教评分比例不能小于0") if ta_proportion < 0 - if !@homework.anonymous_comment - tip_exception("评分比例之和不能大于100") if (te_proportion + ta_proportion) > 1.0 - else - tip_exception("学生评分比例不能为空") if params[:st_proportion].blank? - st_proportion = params[:st_proportion].to_f.round(2) - tip_exception("学生评分比例不能小于0") if st_proportion < 0 - tip_exception("评分比例之和不能大于100") if (te_proportion + ta_proportion + st_proportion) > 1.0 - end - proportion_change = @homework_detail_manual.te_proportion.round(2) != te_proportion || - @homework_detail_manual.ta_proportion.round(2) != ta_proportion - @homework_detail_manual.te_proportion = te_proportion - @homework_detail_manual.ta_proportion = ta_proportion + # 匿评申诉未结束前可以更新:匿评申诉结束时间 + if @homework_detail_manual.comment_status < 5 + tip_exception("匿评申诉结束时间不能为空") if @homework.anonymous_appeal && params[:appeal_time].blank? + tip_exception("匿评开启时间不能早于匿评截止时间") if @homework.anonymous_appeal && + params[:appeal_time] <= strf_time(@homework_detail_manual.evaluation_end) + tip_exception("匿评申诉结束不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if @homework.anonymous_appeal && + @course.end_date.present? && params[:appeal_time] > strf_time(@course.end_date.end_of_day) + + @homework_detail_manual.appeal_time = @homework.anonymous_appeal ? params[:appeal_time] : nil + end + + # 作业未结束可以更新违规匿评扣分 + tip_exception("违规匿评扣分不能为空") if @homework.anonymous_appeal && params[:appeal_penalty].blank? + tip_exception("违规匿评扣分不能小于0") if @homework.anonymous_appeal && params[:appeal_penalty].to_i < 0 + tip_exception("违规匿评扣分不能大于100") if @homework.anonymous_appeal && params[:appeal_penalty].to_i > 100 + @homework_detail_manual.appeal_penalty = @homework.anonymous_appeal ? params[:appeal_penalty].to_i : 0 + + # 如果缺评扣分的设置有变更且匿评已截止 + absence_penalty_change = current_absence_penalty != @homework_detail_manual.absence_penalty && + @homework_detail_manual.comment_status >= 4 + # 如果违规匿评扣分的设置有变更且匿评已截止 + appeal_penalty_change = current_appeal_penalty != @homework_detail_manual.appeal_penalty && + @homework_detail_manual.comment_status >= 4 + + # 评分设置 + tip_exception("助教评分模式不能为空") if params[:ta_mode].blank? + + # 助教评分模式的变更 + ta_mode_change = @homework_detail_manual.ta_mode != params[:ta_mode].to_i + @homework_detail_manual.ta_mode = params[:ta_mode].to_i + + # 最终成绩组成 + tip_exception("最终成绩组成模式不能为空") if params[:final_mode].nil? + + final_mode_change = @homework_detail_manual.final_mode != params[:final_mode] + @homework_detail_manual.final_mode = params[:final_mode] + if !@homework_detail_manual.final_mode + tip_exception("教师评分比例不能为空") if params[:te_proportion].blank? + te_proportion = params[:te_proportion].to_f.round(2) + tip_exception("教师评分比例不能小于0") if te_proportion < 0 + tip_exception("助教评分比例不能为空") if params[:ta_proportion].blank? + ta_proportion = params[:ta_proportion].to_f.round(2) + tip_exception("助教评分比例不能小于0") if ta_proportion < 0 + if !@homework.anonymous_comment + tip_exception("评分比例之和不能大于100") if (te_proportion + ta_proportion) > 1.0 else - @homework_detail_manual.te_proportion = 1 - @homework_detail_manual.ta_proportion = 0 + tip_exception("学生评分比例不能为空") if params[:st_proportion].blank? + st_proportion = params[:st_proportion].to_f.round(2) + tip_exception("学生评分比例不能小于0") if st_proportion < 0 + tip_exception("评分比例之和不能大于100") if (te_proportion + ta_proportion + st_proportion) > 1.0 end - # 公开属性设置 - tip_exception("缺少work_public参数") if params[:work_public].nil? - tip_exception("缺少score_open参数") if params[:score_open].nil? - tip_exception("缺少answer_public参数") if params[:answer_public].nil? - @homework.work_public = params[:work_public] - @homework.score_open = params[:score_open] - @homework.answer_public = params[:answer_public] - - @homework_detail_manual.save! - @homework.save! - - # 迟交扣分、缺评扣分、违规匿评扣分、助教评分模式变更、最终成绩组成、评分比例变更都需要更新学生成绩 - if late_penalty_change || absence_penalty_change || appeal_penalty_change || ta_mode_change || - final_mode_change || proportion_change - - student_works = @homework.student_works.has_committed - work_ids = student_works.pluck(:id) - - student_works.each do |student_work| - # 迟交扣分 - student_work.late_penalty = student_work.work_status == 1 ? 0 : @homework.late_penalty - - # 缺评扣分的更新 如果之前的作业缺评扣分为0,则需重新计算缺评次数 - if absence_penalty_change - absence_penalty_count = current_absence_penalty == 0 ? student_work.absence_count : - (student_work.absence_penalty / current_absence_penalty).to_i - student_work.absence_penalty = absence_penalty_count * @homework_detail_manual.absence_penalty - end + proportion_change = @homework_detail_manual.te_proportion.round(2) != te_proportion || + @homework_detail_manual.ta_proportion.round(2) != ta_proportion + @homework_detail_manual.te_proportion = te_proportion + @homework_detail_manual.ta_proportion = ta_proportion + else + @homework_detail_manual.te_proportion = 1 + @homework_detail_manual.ta_proportion = 0 + end - # 违规匿评扣分 如果之前的作业违规扣分为0,则需重新计算违规匿评次数 - if appeal_penalty_change - appeal_penalty_count = current_appeal_penalty == 0 ? student_work.appeal_count : - (student_work.appeal_penalty / current_appeal_penalty).to_i - student_work.appeal_penalty = appeal_penalty_count * @homework_detail_manual.appeal_penalty - end + # 公开属性设置 + tip_exception("缺少work_public参数") if params[:work_public].nil? + tip_exception("缺少score_open参数") if params[:score_open].nil? + tip_exception("缺少answer_public参数") if params[:answer_public].nil? + @homework.work_public = params[:work_public] + @homework.score_open = params[:score_open] + @homework.answer_public = params[:answer_public] + + @homework_detail_manual.save! + @homework.save! + + # 迟交扣分、缺评扣分、违规匿评扣分、助教评分模式变更、最终成绩组成、评分比例变更都需要更新学生成绩 + if late_penalty_change || absence_penalty_change || appeal_penalty_change || ta_mode_change || + final_mode_change || proportion_change + + student_works = @homework.student_works.has_committed + work_ids = student_works.pluck(:id) + + student_works.each do |student_work| + # 迟交扣分 + student_work.late_penalty = student_work.work_status == 1 ? 0 : @homework.late_penalty + + # 缺评扣分的更新 如果之前的作业缺评扣分为0,则需重新计算缺评次数 + if absence_penalty_change + absence_penalty_count = current_absence_penalty == 0 ? student_work.absence_count : + (student_work.absence_penalty / current_absence_penalty).to_i + student_work.absence_penalty = absence_penalty_count * @homework_detail_manual.absence_penalty + end - # 助教模式变更且有助教评分记录时才更新 - if ta_mode_change && student_work.student_works_scores.where("reviewer_role = 2 AND score IS NOT NULL").count > 0 - student_work.teaching_asistant_score = student_work.ta_score @homework_detail_manual.ta_mode - end + # 违规匿评扣分 如果之前的作业违规扣分为0,则需重新计算违规匿评次数 + if appeal_penalty_change + appeal_penalty_count = current_appeal_penalty == 0 ? student_work.appeal_count : + (student_work.appeal_penalty / current_appeal_penalty).to_i + student_work.appeal_penalty = appeal_penalty_count * @homework_detail_manual.appeal_penalty + end - student_work.save! + # 助教模式变更且有助教评分记录时才更新 + if ta_mode_change && student_work.student_works_scores.where("reviewer_role = 2 AND score IS NOT NULL").count > 0 + student_work.teaching_asistant_score = student_work.ta_score @homework_detail_manual.ta_mode end - end + student_work.save! + end end - normal_status(0, "更新成功") - else - tip_exception("课堂已结束不能再更新") + end + normal_status(0, "更新成功") + else + tip_exception("课堂已结束不能再更新") + end # rescue ActiveRecord::RecordInvalid # render_error("保存失败") # rescue ApplicationService::Error => ex # uid_logger(ex.message) # render_error(ex.message) # raise ActiveRecord::Rollback - rescue Exception => e - uid_logger(e.backtrace) - tip_exception(e.message) - raise ActiveRecord::Rollback - end end # 选用实训 @@ -799,7 +770,7 @@ class HomeworkCommonsController < ApplicationController @total_count = @shixuns.size ## 分页参数 - page = params[:page] || 1 + page = params[:page] || 1 @shixuns = @shixuns.reorder("shixuns.created_at desc").includes(:challenges, user: [user_extension: :school]).page(page).per(10) end @@ -822,15 +793,15 @@ class HomeworkCommonsController < ApplicationController def subjects @tags = Repertoire.where(nil).order("updated_at desc") # select = params[:select] # 路径导航类型 - select = params[:type] # 路径导航类型 + select = params[:type] # 路径导航类型 reorder = params[:order] || "myshixun_count" sort = params[:sort] || "desc" search = params[:search] ## 分页参数 - page = params[:page] || 1 + page = params[:page] || 1 limit = params[:limit] || 15 - offset = (page.to_i-1) * limit + offset = (page.to_i - 1) * limit # 最热排序 if reorder == "myshixun_count" @@ -903,8 +874,8 @@ class HomeworkCommonsController < ApplicationController # 为实训作业创建与stage同名的子目录 category = CourseSecondCategory.find_by(name: stage.name, course_id: @course.id, category_type: "shixun_homework") || - CourseSecondCategory.create!(name: stage.name, course_id: @course.id, category_type: "shixun_homework", - course_module_id: course_module.id, position: course_module.course_second_categories.count + 1) + CourseSecondCategory.create!(name: stage.name, course_id: @course.id, category_type: "shixun_homework", + course_module_id: course_module.id, position: course_module.course_second_categories.count + 1) # 去掉不对当前用户的单位公开的实训,已发布的实训 stage.shixuns.no_jupyter.where(id: shixun_ids).unhidden.each do |shixun| @@ -935,16 +906,14 @@ class HomeworkCommonsController < ApplicationController if params[:detail].blank? tip_exception("缺少截止时间参数") if params[:end_time].blank? tip_exception("截止时间不能早于当前时间") if params[:end_time] <= strf_time(Time.now) - tip_exception("截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if - @course.end_date.present? && params[:end_time] > strf_time(@course.end_date.end_of_day) + tip_exception("截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if @course.end_date.present? && params[:end_time] > strf_time(@course.end_date.end_of_day) else tip_exception("缺少分班截止时间参数") if params[:group_end_times].blank? - group_end_times = params[:group_end_times].reject(&:blank?)&.map{|time| time.to_time} + group_end_times = params[:group_end_times].reject(&:blank?)&.map {|time| time.to_time} tip_exception("截止时间和分班参数的个数不一致") if group_end_times.length != group_ids.length group_end_times.each do |time| tip_exception("分班截止时间不能早于当前时间") if time <= Time.now - tip_exception("分班截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if - @course.end_date.present? && time > @course.end_date.end_of_day + tip_exception("分班截止时间不能晚于课堂结束时间(#{@course.end_date.end_of_day.strftime("%Y-%m-%d %H:%M")})") if @course.end_date.present? && time > @course.end_date.end_of_day end end @@ -955,94 +924,89 @@ class HomeworkCommonsController < ApplicationController publish_groups = charge_group_ids & group_ids if group_ids # ActiveRecord::Base.transaction do - begin - homeworks.each do |homework| - # 作业未发布时 - if homework.homework_detail_manual.try(:comment_status) == 0 - if !params[:group_ids].blank? - - # 全选即统一设置,unified_setting为true - if @course.course_groups.where(id: publish_groups).size == @course.course_groups.size && - ((params[:detail] && group_end_times.min == group_end_times.max) || params[:detail].blank?) - homework.homework_group_settings.destroy_all - homework.unified_setting = true - homework.end_time = params[:detail] ? group_end_times.max : params[:end_time] - else - homework.unified_setting = false - # 创建作业分班设置:homework_group_setting - homework.create_homework_group_settings - - # 选中的分班设置的发布时间改为当前时间,截止时间改为传的截止时间参数 - if params[:detail] - group_ids.each_with_index do |group_id, index| - homework.homework_group_settings.find_by(course_group_id: group_id)&.update_attributes!(publish_time: Time.now, - end_time: group_end_times[index]) - end - else - homework.homework_group_settings.where(course_group_id: publish_groups).update_all(publish_time: Time.now, - end_time: params[:end_time]) - end - # 发消息 - tiding_group_ids = publish_groups - end - else - homework.homework_group_settings.destroy_all - # students = @course.students - end - - homework.publish_time = Time.now - - # 截止时间的处理 - if homework.end_time.nil? - homework.end_time = params[:detail] ? group_end_times.max : params[:end_time] - elsif homework.max_group_end_time - homework.end_time = homework.max_group_end_time - end - homework.homework_detail_manual.update_attributes!(comment_status: 1) - - if homework.course_act.blank? - CourseActivity.create!(user_id: homework.user_id, course_id: homework.course_id, course_act: homework) - end - # 发消息 - HomeworkCommonPushNotifyJob.perform_later(homework.id, tiding_group_ids) + homeworks.each do |homework| + # 作业未发布时 + if homework.homework_detail_manual.try(:comment_status) == 0 + if !params[:group_ids].blank? + + # 全选即统一设置,unified_setting为true + if @course.course_groups.where(id: publish_groups).size == @course.course_groups.size && + ((params[:detail] && group_end_times.min == group_end_times.max) || params[:detail].blank?) + homework.homework_group_settings.destroy_all + homework.unified_setting = true + homework.end_time = params[:detail] ? group_end_times.max : params[:end_time] else + homework.unified_setting = false + # 创建作业分班设置:homework_group_setting homework.create_homework_group_settings - none_publish_settings = homework.homework_group_settings.where(course_group_id: publish_groups).none_published + # 选中的分班设置的发布时间改为当前时间,截止时间改为传的截止时间参数 if params[:detail] group_ids.each_with_index do |group_id, index| - none_publish_settings.find_by(course_group_id: group_id)&.update_attributes!(publish_time: Time.now, - end_time: group_end_times[index]) + homework.homework_group_settings.find_by(course_group_id: group_id)&.update_attributes!(publish_time: Time.now, + end_time: group_end_times[index]) end else - none_publish_settings.update_all(publish_time: Time.now, end_time: params[:end_time]) + homework.homework_group_settings.where(course_group_id: publish_groups).update_all(publish_time: Time.now, + end_time: params[:end_time]) end - - if homework.max_group_end_time - homework.end_time = homework.max_group_end_time - end - HomeworkCommonPushNotifyJob.perform_later(homework.id, none_publish_settings.pluck(:course_group_id)) + # 发消息 + tiding_group_ids = publish_groups end + else + homework.homework_group_settings.destroy_all + # students = @course.students + end + homework.publish_time = Time.now - if homework.end_time > Time.now && homework.homework_detail_manual.try(:comment_status) > 1 - homework.homework_detail_manual.update_attributes!(comment_status: 1) - end + # 截止时间的处理 + if homework.end_time.nil? + homework.end_time = params[:detail] ? group_end_times.max : params[:end_time] + elsif homework.max_group_end_time + homework.end_time = homework.max_group_end_time + end + homework.homework_detail_manual.update_attributes!(comment_status: 1) - # 补交结束时间 - homework.late_time = Time.at(homework.end_time.to_i + 30*24*3600) if homework.allow_late && homework.late_time.nil? + if homework.course_act.blank? + CourseActivity.create!(user_id: homework.user_id, course_id: homework.course_id, course_act: homework) + end + # 发消息 + HomeworkCommonPushNotifyJob.perform_later(homework.id, tiding_group_ids) + else + homework.create_homework_group_settings - homework.save! + none_publish_settings = homework.homework_group_settings.where(course_group_id: publish_groups).none_published + if params[:detail] + group_ids.each_with_index do |group_id, index| + none_publish_settings.find_by(course_group_id: group_id)&.update_attributes!(publish_time: Time.now, + end_time: group_end_times[index]) + end + else + none_publish_settings.update_all(publish_time: Time.now, end_time: params[:end_time]) + end - # 更新学生状态及成绩(手动点击计算) - # HomeworkPublishUpdateWorkStatusJob.perform_later(tiding_group_ids, homework.id) + if homework.max_group_end_time + homework.end_time = homework.max_group_end_time end - normal_status(0, "发布成功") - rescue Exception => e - uid_logger(e.message) - tip_exception("发布失败") - raise ActiveRecord::Rollback + HomeworkCommonPushNotifyJob.perform_later(homework.id, none_publish_settings.pluck(:course_group_id)) end + + + if homework.end_time > Time.now && homework.homework_detail_manual.try(:comment_status) > 1 + homework.homework_detail_manual.update_attributes!(comment_status: 1) + end + + # 补交结束时间 + homework.late_time = Time.at(homework.end_time.to_i + 30 * 24 * 3600) if homework.allow_late && homework.late_time.nil? + + homework.save! + + # 更新学生状态及成绩(手动点击计算) + # HomeworkPublishUpdateWorkStatusJob.perform_later(tiding_group_ids, homework.id) + end + normal_status(0, "发布成功") + # end end @@ -1051,9 +1015,9 @@ class HomeworkCommonsController < ApplicationController charge_ids = @course.charge_group_ids(@current_user) if @homework.end_immediately charge_ids # 可立即截止的分班:统一设置则是用户管理的所有分班,否则是当前用户管理的分班中已发布且未截止的 - charge_group_ids = @course.charge_group_ids(@current_user) # 当前用户管理的分班 + charge_group_ids = @course.charge_group_ids(@current_user) # 当前用户管理的分班 group_ids = @homework.unified_setting ? charge_group_ids : - @homework.homework_group_settings.where(course_group_id: charge_group_ids).published_no_end.pluck(:course_group_id) + @homework.homework_group_settings.where(course_group_id: charge_group_ids).published_no_end.pluck(:course_group_id) @course_groups = @course.course_groups.where(id: group_ids) else tip_exception("没有可截止的分班") @@ -1074,56 +1038,50 @@ class HomeworkCommonsController < ApplicationController group_ids = params[:group_ids]&.reject(&:blank?)&.map(&:to_i) end_groups = charge_group_ids & group_ids if group_ids - begin - homeworks.each do |homework| - ActiveRecord::Base.transaction do - homework_detail_manual = homework.homework_detail_manual - - # 分组设置 - if !params[:group_ids].blank? - # 确保之前是统一设置或者有新创建的分班的数据一致性 - homework.create_homework_group_settings + homeworks.each do |homework| + ActiveRecord::Base.transaction do + homework_detail_manual = homework.homework_detail_manual - homework.unified_setting = false if homework.unified_setting && end_groups.length != @course.course_groups_count + # 分组设置 + if !params[:group_ids].blank? + # 确保之前是统一设置或者有新创建的分班的数据一致性 + homework.create_homework_group_settings - # 已发布且未截止的分班 - none_end_settings = homework.homework_group_settings.where(course_group_id: end_groups).published_no_end + homework.unified_setting = false if homework.unified_setting && end_groups.length != @course.course_groups_count - none_end_settings.update_all(end_time: time) - student_works = homework.student_works.where(user_id: course_students.where(course_group_id: none_end_settings. - pluck(:course_group_id)).pluck(:user_id)).has_committed if homework.homework_type == "practice" + # 已发布且未截止的分班 + none_end_settings = homework.homework_group_settings.where(course_group_id: end_groups).published_no_end - homework.end_time = homework.max_group_end_time - if homework.end_time > time && homework_detail_manual.try(:comment_status) > 1 - homework_detail_manual.update_attributes!(comment_status: 1) - end + none_end_settings.update_all(end_time: time) + student_works = homework.student_works.where(user_id: course_students.where(course_group_id: none_end_settings. + pluck(:course_group_id)).pluck(:user_id)).has_committed if homework.homework_type == "practice" - # 统一设置 - elsif homework.unified_setting - student_works = homework.student_works.has_committed if homework.homework_type == "practice" - homework.end_time = time + homework.end_time = homework.max_group_end_time + if homework.end_time > time && homework_detail_manual.try(:comment_status) > 1 + homework_detail_manual.update_attributes!(comment_status: 1) end - # homework_detail_manual.update_attributes!(comment_status: 2) if homework.end_time <= time + # 统一设置 + elsif homework.unified_setting + student_works = homework.student_works.has_committed if homework.homework_type == "practice" + homework.end_time = time + end + + # homework_detail_manual.update_attributes!(comment_status: 2) if homework.end_time <= time - # 实训作业的作品需要计算是否迟交 - if homework.homework_type == "practice" - # shixun = homework.shixuns.first - # homework_challenge_settings = homework.homework_challenge_settings - unless student_works.blank? - student_works.joins(:myshixun).where("myshixuns.status != 1").update_all(late_penalty: homework.late_penalty) if homework.allow_late - end + # 实训作业的作品需要计算是否迟交 + if homework.homework_type == "practice" + # shixun = homework.shixuns.first + # homework_challenge_settings = homework.homework_challenge_settings + unless student_works.blank? + student_works.joins(:myshixun).where("myshixuns.status != 1").update_all(late_penalty: homework.late_penalty) if homework.allow_late end - homework.save! end - HomeworkEndUpdateScoreJob.perform_later(homework.id) if !homework.allow_late && homework.end_time <= time + homework.save! end - normal_status(0, "更新成功") - rescue Exception => e - uid_logger(e.message) - tip_exception("操作失败") - raise ActiveRecord::Rollback + HomeworkEndUpdateScoreJob.perform_later(homework.id) if !homework.allow_late && homework.end_time <= time end + normal_status(0, "更新成功") end def set_public @@ -1156,19 +1114,13 @@ class HomeworkCommonsController < ApplicationController # 删除多个作业 def multi_destroy ActiveRecord::Base.transaction do - begin - homeworks = @course.homework_commons.where(id: params[:homework_ids]) - homeworks.destroy_all - - # 这些写是因为model中的关联删除无法删除is_delete=0的作品 - StudentWork.where(homework_common_id: homeworks.pluck(:id)).destroy_all - normal_status(0, "删除成功") - - rescue Exception => e - uid_logger(e.message) - tip_exception("删除失败") - raise ActiveRecord::Rollback - end + homeworks = @course.homework_commons.where(id: params[:homework_ids]) + homeworks.destroy_all + + # 这些写是因为model中的关联删除无法删除is_delete=0的作品 + StudentWork.where(homework_common_id: homeworks.pluck(:id)).destroy_all + normal_status(0, "删除成功") + end end @@ -1178,41 +1130,35 @@ class HomeworkCommonsController < ApplicationController homeworks.each do |homework| ActiveRecord::Base.transaction do - begin - homework_bank = current_user.homework_banks.find_by(homework_common_id: homework.id) - if homework_bank.present? - # 如果作业加入过题库则更新参数 - if homework_bank.homework_type == 1 - homework_bank.update_attributes!(name: homework.name, description: homework.description, - reference_answer: homework.reference_answer, course_list_id: @course.course_list_id) - elsif homework_bank.homework_type == 3 - homework_detail_group = homework.homework_detail_group - homework_bank.update_attributes!(name: homework.name, description: homework.description, - reference_answer: homework.reference_answer, course_list_id: @course.course_list_id, - min_num: homework_detail_group.min_num, max_num: homework_detail_group.max_num, - base_on_project: homework_detail_group.base_on_project) - end - - # 附件的更新 - homework_bank.attachments.destroy_all - homework.attachments.each do |attachment| - att = attachment.copy - att.author_id = homework_bank.user_id - att.copy_from = attachment.id - homework_bank.attachments << att - end - else - new_homework_bank = add_to_homework_bank_f homework - new_homework_bank.save! + homework_bank = current_user.homework_banks.find_by(homework_common_id: homework.id) + if homework_bank.present? + # 如果作业加入过题库则更新参数 + if homework_bank.homework_type == 1 + homework_bank.update_attributes!(name: homework.name, description: homework.description, + reference_answer: homework.reference_answer, course_list_id: @course.course_list_id) + elsif homework_bank.homework_type == 3 + homework_detail_group = homework.homework_detail_group + homework_bank.update_attributes!(name: homework.name, description: homework.description, + reference_answer: homework.reference_answer, course_list_id: @course.course_list_id, + min_num: homework_detail_group.min_num, max_num: homework_detail_group.max_num, + base_on_project: homework_detail_group.base_on_project) + end - homework.update_attributes!(homework_bank_id: new_homework_bank.id) + # 附件的更新 + homework_bank.attachments.destroy_all + homework.attachments.each do |attachment| + att = attachment.copy + att.author_id = homework_bank.user_id + att.copy_from = attachment.id + homework_bank.attachments << att end + else + new_homework_bank = add_to_homework_bank_f homework + new_homework_bank.save! - rescue Exception => e - uid_logger(e.message) - tip_exception(e.message) - raise ActiveRecord::Rollback + homework.update_attributes!(homework_bank_id: new_homework_bank.id) end + end end normal_status(0, "加入成功") @@ -1229,7 +1175,7 @@ class HomeworkCommonsController < ApplicationController # 班级作品查重 def homework_code_repeat - tip_exception(-1,"分班id不能为空!") if params[:group_ids].nil? + tip_exception(-1, "分班id不能为空!") if params[:group_ids].nil? shixun = @homework.shixuns.take # 通过代码文件来判断语言 language = shixun.challenges.practice_type.pluck(:path).first @@ -1247,16 +1193,16 @@ class HomeworkCommonsController < ApplicationController games.each do |game| game.game_codes.each do |game_code| code_infos << { - path: game_code.path, - content: Base64.urlsafe_encode64(game_code.new_code.to_s, padding: false), - passed_time: game.end_time.try(:strftime, '%Y-%m-%d %H:%M:%S') + path: game_code.path, + content: Base64.urlsafe_encode64(game_code.new_code.to_s, padding: false), + passed_time: game.end_time.try(:strftime, '%Y-%m-%d %H:%M:%S') } end end if code_infos.size != 0 user_lists << { - user_id: user_id, - code_info: code_infos + user_id: user_id, + code_info: code_infos } end end @@ -1270,13 +1216,13 @@ class HomeworkCommonsController < ApplicationController normal_status("代码查重成功") else if result.status == 1 - tip_exception(-4,"代码查重异常,请稍后重试") + tip_exception(-4, "代码查重异常,请稍后重试") else - tip_exception(-3,"正在查重,请在几分钟后刷新页面查看结果") + tip_exception(-3, "正在查重,请在几分钟后刷新页面查看结果") end end else - tip_exception(-2,"平台目前支持java、python语言的查重
    其他语言正在规划中,敬请期待") + tip_exception(-2, "平台目前支持java、python语言的查重
    其他语言正在规划中,敬请期待") end end @@ -1295,23 +1241,23 @@ class HomeworkCommonsController < ApplicationController student_works = @homework.student_works.where("work_status > 0") # 按分班id搜索 user_ids = - if params[:group_ids] - # 筛选了分班 - group_student_ids = @course.course_members.where(course_group_id: params[:group_ids]).pluck(:user_id) - student_works.where(:user_id => group_student_ids).pluck(:user_id) + if params[:group_ids] + # 筛选了分班 + group_student_ids = @course.course_members.where(course_group_id: params[:group_ids]).pluck(:user_id) + student_works.where(:user_id => group_student_ids).pluck(:user_id) + else + # 如果当前用户有分班 显示分班内的学生,没有则显示全部 + user_ids = @course.user_group_students(current_user.id).pluck(:user_id) + if user_ids.present? + student_works.where(:user_id => user_ids).pluck(:user_id) else - # 如果当前用户有分班 显示分班内的学生,没有则显示全部 - user_ids = @course.user_group_students(current_user.id).pluck(:user_id) - if user_ids.present? - student_works.where(:user_id => user_ids).pluck(:user_id) - else - student_works.pluck(:user_id) - end + student_works.pluck(:user_id) end + end # 查询作品数总数 @all_reviews_count = user_ids.count @users_reviews = @homework.homework_review_results.where("code_rate >= 50.0") - .where(:user_id => user_ids).joins(user: :user_extension) + .where(:user_id => user_ids).joins(user: :user_extension) # 按学号和姓名搜索 if params[:search] @users_reviews = @users_reviews.where("concat(lastname, firstname) like :keyword or student_id like :keyword", keyword: "%#{params[:search]}%") @@ -1325,9 +1271,9 @@ class HomeworkCommonsController < ApplicationController # 如果未分班被查重过,则显示未分班列 @non_course_group = - if @homework.homework_group_reviews.where(course_group_id: 0).count > 0 - @course.course_members.where(role: 4, course_group_id: 0).count - end + if @homework.homework_group_reviews.where(course_group_id: 0).count > 0 + @course.course_members.where(role: 4, course_group_id: 0).count + end # 最新一次的查重时间 @last_review_time = format_time @homework.homework_group_reviews.last.try(:created_at) @@ -1353,38 +1299,38 @@ class HomeworkCommonsController < ApplicationController homework_challenge_settings = @homework.homework_challenge_settings @challenges = @shixun.challenges.where(id: homework_challenge_settings.pluck(:challenge_id), st: 0) @challenges = - @challenges.map do |challenge| - code_rate = 0 - game_codes = results.code_info.select {|info| challenge.path.split(";").include?(info.origin_path)} - # 先判断用户该关卡是否查重了 取多个待补充文件的平均值 - if game_codes.count > 0 - code_rate += game_codes.map(&:rate).sum / challenge.path.split(";").length - end - logger.info("#####game_codes: #{game_codes}") - #target = game_codes.count > 0 ? game_codes[0].target_user_id : nil - # 作品完成时间 - game = challenge.games.find_by(user_id: @user.id) - end_time = game.end_time - # 用户关卡的得分 - all_score = homework_challenge_settings.find_by(challenge_id: challenge.id).try(:score).to_f - final_score = @student_work.work_challenge_score game, all_score, challenge.id - # 抄袭用户 - copy_user = User.find_by_id(game_codes[0].try(:target_user_id)) - copy_end_time = copy_user.games.find_by(challenge_id: challenge.id).try(:end_time) if copy_user.present? - # 代码部分 - code_list = [] - challenge.path.split(";").each do |path| - if code_info.select{|info| path == info.origin_path}.size > 0 - info = code_info.select{|info| path == info.origin_path}[0] - code_list << {path: path, origin_content: info.origin_content, target_content: info.target_content} - end + @challenges.map do |challenge| + code_rate = 0 + game_codes = results.code_info.select {|info| challenge.path.split(";").include?(info.origin_path)} + # 先判断用户该关卡是否查重了 取多个待补充文件的平均值 + if game_codes.count > 0 + code_rate += game_codes.map(&:rate).sum / challenge.path.split(";").length + end + logger.info("#####game_codes: #{game_codes}") + #target = game_codes.count > 0 ? game_codes[0].target_user_id : nil + # 作品完成时间 + game = challenge.games.find_by(user_id: @user.id) + end_time = game.end_time + # 用户关卡的得分 + all_score = homework_challenge_settings.find_by(challenge_id: challenge.id).try(:score).to_f + final_score = @student_work.work_challenge_score game, all_score, challenge.id + # 抄袭用户 + copy_user = User.find_by_id(game_codes[0].try(:target_user_id)) + copy_end_time = copy_user.games.find_by(challenge_id: challenge.id).try(:end_time) if copy_user.present? + # 代码部分 + code_list = [] + challenge.path.split(";").each do |path| + if code_info.select {|info| path == info.origin_path}.size > 0 + info = code_info.select {|info| path == info.origin_path}[0] + code_list << {path: path, origin_content: info.origin_content, target_content: info.target_content} end - # TODO: 这里本来应该前端做的,但是现在页面已经刷不开了。 - {code_rate: code_rate, copy_user_id: copy_user.try(:id), end_time: end_time, final_score: final_score, - all_score: all_score, copy_end_time: copy_end_time, copy_username: copy_user.try(:full_name), - username: game.user.full_name, code_list: code_list, subject: challenge.subject, position: challenge.position, - id: challenge.id} end + # TODO: 这里本来应该前端做的,但是现在页面已经刷不开了。 + {code_rate: code_rate, copy_user_id: copy_user.try(:id), end_time: end_time, final_score: final_score, + all_score: all_score, copy_end_time: copy_end_time, copy_username: copy_user.try(:full_name), + username: game.user.full_name, code_list: code_list, subject: challenge.subject, position: challenge.position, + id: challenge.id} + end else if results.status == 1 @@ -1461,8 +1407,8 @@ class HomeworkCommonsController < ApplicationController user_rate = 0 # 计算每个关卡的相似度 challenges.each do |challenge| - game_codes = results.user_lists.select{|user_list| user_list.user_id == user && - challenge.path.split(";").include?(user_list.origin_path)} + game_codes = results.user_lists.select {|user_list| user_list.user_id == user && + challenge.path.split(";").include?(user_list.origin_path)} # 先判断用户该关卡是否查重了 取多个待补充文件的平均值 if game_codes.count > 0 user_rate += game_codes.map(&:rate).sum / challenge.path.split(";").length From ea9925f2b092b26c05343acba8d309ba1ee2e4f7 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 6 Mar 2020 20:48:58 +0800 Subject: [PATCH 18/54] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/examination_banks_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/examination_banks_controller.rb b/app/controllers/examination_banks_controller.rb index cc34d9fea..3df11a432 100644 --- a/app/controllers/examination_banks_controller.rb +++ b/app/controllers/examination_banks_controller.rb @@ -36,8 +36,8 @@ class ExaminationBanksController < ApplicationController end current_user.item_baskets.destroy_all + render_ok({exam_id: exam.id}) end - render_ok rescue ApplicationService::Error => ex render_error(ex.message) end From 17ef1d3a2af2425c6f73e2428384ffef63cdffb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 6 Mar 2020 21:08:28 +0800 Subject: [PATCH 19/54] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E9=A2=98=E5=BA=93?= =?UTF-8?q?=E5=8F=AF=E4=BB=A5=E8=BE=93=E5=85=A5=E7=A9=BA=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../question/component/ChoquesEditor.js | 73 +++++-------------- .../question/component/JudquestionEditor.js | 60 +++++---------- .../question/component/SingleEditor.js | 64 ++++++---------- public/react/src/modules/tpm/NewHeader.js | 30 ++++---- 4 files changed, 78 insertions(+), 149 deletions(-) diff --git a/public/react/src/modules/question/component/ChoquesEditor.js b/public/react/src/modules/question/component/ChoquesEditor.js index 725817d17..d2a0b231b 100644 --- a/public/react/src/modules/question/component/ChoquesEditor.js +++ b/public/react/src/modules/question/component/ChoquesEditor.js @@ -229,22 +229,9 @@ class ChoquesEditor extends Component{ var texts; const _text = quill.getText(); const reg = /^[\s\S]*.*[^\s][\s\S]*$/; - - - - - if(this.isNull(_text)===true){ - - return - } - if (!reg.test(_text)) { // 处理编辑器内容为空 - try { - texts=JSON.stringify(value); - }catch (e) { texts=""; - } } else { if(_text.length>=500){ var result = _text.substring(0,450); @@ -298,66 +285,46 @@ class ChoquesEditor extends Component{ // debugger const _text = quill.getText(); const reg = /^[\s\S]*.*[^\s][\s\S]*$/; - - if(this.isNull(_text)===true){ - this.setState({ - question_titleysl:"" - }) - return - } - - if (!reg.test(_text)) { // 处理编辑器内容为空 - try { - this.setState({ - question_titleysl: JSON.stringify(value) - }) - }catch (e) { this.setState({ question_titleysl:"" }) - } } else { // 提交到后台的内容需要处理一下; - let texts=""; - texts = JSON.stringify(value); - this.setState({ - question_titleysl:texts - }) + try { + let texts = JSON.stringify(value); + this.setState({ + question_titleysl:texts + }) + }catch (e) { + this.setState({ + question_titleysl:"" + }) + } } } onContentChanges=(value,quill)=>{ const _text = quill.getText(); const reg = /^[\s\S]*.*[^\s][\s\S]*$/; - - - if(this.isNull(_text)===true){ - this.setState({ - question_titlesysl:"" - }) - return - } - if (!reg.test(_text)) { // 处理编辑器内容为空 - try { - this.setState({ - question_titlesysl: JSON.stringify(value) - }) - }catch (e) { this.setState({ question_titlesysl:"" }) - } } else { // 提交到后台的内容需要处理一下; - let texts=""; + try { + let texts = JSON.stringify(value); + this.setState({ + question_titlesysl:texts + }) + }catch (e) { + this.setState({ + question_titlesysl:"" + }) + } - texts = JSON.stringify(value); - this.setState({ - question_titlesysl:texts - }) } } diff --git a/public/react/src/modules/question/component/JudquestionEditor.js b/public/react/src/modules/question/component/JudquestionEditor.js index 603fbd6e7..868700c6b 100644 --- a/public/react/src/modules/question/component/JudquestionEditor.js +++ b/public/react/src/modules/question/component/JudquestionEditor.js @@ -303,72 +303,50 @@ class JudquestionEditor extends Component{ // console.log(quill); const _text = quill.getText(); const reg = /^[\s\S]*.*[^\s][\s\S]*$/; - // console.log(_text); - // console.log(_text.length); - if(this.isNull(_text)===true){ - this.setState({ - question_titleysl:"" - }) - return - } - if (!reg.test(_text)) { // 处理编辑器内容为空 - try { this.setState({ - question_titleysl:JSON.stringify(value) + question_titleysl:"" + }) + // console.log("空"); + } else { + // 提交到后台的内容需要处理一下; + try { + let texts = JSON.stringify(value); + this.setState({ + question_titleysl:texts }) }catch (e) { this.setState({ question_titleysl:"" }) } - - // console.log("空"); - } else { - // console.log("有"); - - // 提交到后台的内容需要处理一下; - let texts=""; - texts = JSON.stringify(value); - this.setState({ - question_titleysl:texts - }) } } onContentChanges=(value,quill)=>{ const _text = quill.getText(); const reg = /^[\s\S]*.*[^\s][\s\S]*$/; - - if(this.isNull(_text)===true){ - this.setState({ - question_titlesysl:"" - }) - return - } if (!reg.test(_text)) { // 处理编辑器内容为空 - try { - this.setState({ - question_titlesysl:JSON.stringify(value) - }) - }catch (e) { this.setState({ question_titlesysl:"" }) - } - } else { // 提交到后台的内容需要处理一下; - let texts=""; + try { - texts = JSON.stringify(value); - this.setState({ - question_titlesysl:texts - }) + let texts = JSON.stringify(value); + this.setState({ + question_titlesysl:texts + }) + }catch (e) { + this.setState({ + question_titlesysl:"" + }) + } } } render() { diff --git a/public/react/src/modules/question/component/SingleEditor.js b/public/react/src/modules/question/component/SingleEditor.js index 464eb19e0..fab9170b8 100644 --- a/public/react/src/modules/question/component/SingleEditor.js +++ b/public/react/src/modules/question/component/SingleEditor.js @@ -140,7 +140,13 @@ class SingleEditor extends Component{ // this.refs['titleEditor'].showError() this.props.showNotification('请您输入题干'); return editordata; + }else{ + console.log("question_titleysl"); + console.log(question_titleysl); } + + + for(let i = 0; i < question_choices.length; i++) { if (!question_choices[i]) { // this.refs[`optionEditor${i}`].showError() @@ -244,6 +250,7 @@ class SingleEditor extends Component{ this.setState({ standard_answers }) } onOptionContentChange = (value,quill,index) => { + debugger if (index >= this.state.question_choices.length) { // TODO 新建,然后删除CD选项,再输入题干,会调用到这里,且index是3 return; @@ -251,18 +258,9 @@ class SingleEditor extends Component{ var texts; const _text = quill.getText(); const reg = /^[\s\S]*.*[^\s][\s\S]*$/; - - - if(this.isNull(_text)===true){ - return - } if (!reg.test(_text)) { // 处理编辑器内容为空 - try { - texts= JSON.stringify(value) - }catch (e) { texts=""; - } } else { if(_text.length>=500){ var result = _text.substring(0,450); @@ -315,61 +313,47 @@ class SingleEditor extends Component{ const reg = /^[\s\S]*.*[^\s][\s\S]*$/; - - if(this.isNull(_text)===true){ - this.setState({ - question_titleysl:"" - }) - return - } - - - if (!reg.test(_text)) { // 处理编辑器内容为空 - try { - this.setState({ - question_titleysl: JSON.stringify(value) - }) - }catch (e) { this.setState({ question_titleysl:"" }) - } } else { + try { let texts = JSON.stringify(value); - this.setState({ - question_titleysl:texts - }) + this.setState({ + question_titleysl:texts===undefined|| null?"":texts + }) + }catch (e) { + this.setState({ + question_titleysl:"" + }) + } } } onContentChanges=(value,quill)=>{ const _text = quill.getText(); const reg = /^[\s\S]*.*[^\s][\s\S]*$/; - if(this.isNull(_text)===true){ - this.setState({ - question_titlesysl:"" - }) - return - } + if (!reg.test(_text)) { // 处理编辑器内容为空 + this.setState({ + question_titlesysl:"" + }) + } else { try { + let texts = JSON.stringify(value); this.setState({ - question_titlesysl:JSON.stringify(value) + question_titlesysl:texts===undefined|| null?"":texts }) }catch (e) { this.setState({ question_titlesysl:"" }) } - } else { - let texts = JSON.stringify(value); - this.setState({ - question_titlesysl:texts - }) + } } handleShowImage = (url) => { diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index 8d3c85378..dccdbc5a7 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -1075,21 +1075,21 @@ submittojoinclass=(value)=>{ ` } - {/*{*/} - {/* Periofters===true?*/} - {/*
  • */} - {/* */} - {/*
    */} - {/*
    */} - {/* 题库*/} - {/*
    */} - {/*
    */} - {/*
    */} - {/*
  • */} - {/* :""*/} - {/*}*/} + { + Periofters===true? +
  • + +
    +
    + 题库 +
    +
    +
    +
  • + :"" + }
  • Date: Fri, 6 Mar 2020 21:09:09 +0800 Subject: [PATCH 20/54] =?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/tpm/NewHeader.js | 30 +++++++++++------------ 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index dccdbc5a7..8d3c85378 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -1075,21 +1075,21 @@ submittojoinclass=(value)=>{ ` } - { - Periofters===true? -
  • - -
    -
    - 题库 -
    -
    -
    -
  • - :"" - } + {/*{*/} + {/* Periofters===true?*/} + {/*
  • */} + {/* */} + {/*
    */} + {/*
    */} + {/* 题库*/} + {/*
    */} + {/*
    */} + {/*
    */} + {/*
  • */} + {/* :""*/} + {/*}*/}
  • Date: Fri, 6 Mar 2020 21:15:33 +0800 Subject: [PATCH 21/54] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=BB=9F=E8=AE=A1?= =?UTF-8?q?=E9=A1=B5=E9=9D=A2=E8=BF=9B=E5=85=A5=E9=80=80=E5=87=BA=E5=87=BA?= =?UTF-8?q?=E7=8E=B0=E7=99=BD=E5=B1=8F=E7=9A=84=E6=83=85=E5=86=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/paths/statics/index.js | 3 ++- public/react/src/redux/actions/static.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/paths/statics/index.js b/public/react/src/modules/paths/statics/index.js index b4eeec035..5988f113d 100644 --- a/public/react/src/modules/paths/statics/index.js +++ b/public/react/src/modules/paths/statics/index.js @@ -216,7 +216,8 @@ const App = (props) => { useEffect(() => { changeParams({ - page: 1 + page: 1, + type: "subject_info" }); pathId && staticList(pathId); }, []); diff --git a/public/react/src/redux/actions/static.js b/public/react/src/redux/actions/static.js index 77c4e0267..2c57479fb 100644 --- a/public/react/src/redux/actions/static.js +++ b/public/react/src/redux/actions/static.js @@ -12,7 +12,7 @@ import { fetchStaticList } from "../../services/staticService"; export const staticList = (id) => { return (dispatch, getState) => { const { params, total_count, other_info } = getState().staticReducer; - // console.log('统计数据=====>>>>>', params); + console.log('统计数据=====>>>>>', params); // if (total_count !== 0 && total_count === other_info.length) return; fetchStaticList(id, params).then(res => { // console.log('统计数据=====>>>>>', res); From a02c622293ab58bff12a036f8ccfb3a118ad22f0 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 6 Mar 2020 21:25:12 +0800 Subject: [PATCH 22/54] =?UTF-8?q?games=E8=A1=A8=E5=A2=9E=E5=8A=A0user=5Fid?= =?UTF-8?q?=E7=9A=84=E7=B4=A2=E5=BC=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- db/migrate/20200306131654_add_user_id_index_for_games.rb | 5 +++++ lib/tasks/static_all.rake | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 db/migrate/20200306131654_add_user_id_index_for_games.rb diff --git a/db/migrate/20200306131654_add_user_id_index_for_games.rb b/db/migrate/20200306131654_add_user_id_index_for_games.rb new file mode 100644 index 000000000..ec92a1a08 --- /dev/null +++ b/db/migrate/20200306131654_add_user_id_index_for_games.rb @@ -0,0 +1,5 @@ +class AddUserIdIndexForGames < ActiveRecord::Migration[5.2] + def change + add_index :games, :user_id + end +end diff --git a/lib/tasks/static_all.rake b/lib/tasks/static_all.rake index 2290f0dc5..58a11572d 100644 --- a/lib/tasks/static_all.rake +++ b/lib/tasks/static_all.rake @@ -2,7 +2,7 @@ desc "统计每个学校使用数据" namespace :static_all do task :repo => :environment do - school_alls = School.includes(:courses, user_extensions: :user).all + school_alls = School.includes(courses: [:homework_commons, :attachments, :course_videos], user_extensions: :user).where(id: 117) proc_num = ENV['processes'].blank? ? 5 : ENV['processes'].to_i school_alls.find_in_batches(batch_size: 50) do |schools| Parallel.each(schools, in_processes: proc_num) do |school| From d667dbf809bdf0e54183e2a7eb09235ea8ac3699 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 6 Mar 2020 21:38:09 +0800 Subject: [PATCH 23/54] =?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/question/component/Contentpart.js | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/public/react/src/modules/question/component/Contentpart.js b/public/react/src/modules/question/component/Contentpart.js index 516e6be1f..449e0e9e4 100644 --- a/public/react/src/modules/question/component/Contentpart.js +++ b/public/react/src/modules/question/component/Contentpart.js @@ -348,11 +348,12 @@ class Contentpart extends Component { .xaxisreverseorder .ant-input-group-addon{ width: 48px !important; - + } - .xaxisreverseorder .ant-input-lg { - height: 41px !important;} + .xaxisreverseorder .ant-input-wrapper .ant-input-group-addon button .ant-input-lg { + height: 39px !important; + } .xaxisreverseorder .ant-popover{ top: 30px !important; From fbe15fec18b55747179b4945ad36a81fe24fd59c Mon Sep 17 00:00:00 2001 From: caicai8 <1149225589@qq.com> Date: Fri, 6 Mar 2020 21:45:09 +0800 Subject: [PATCH 24/54] =?UTF-8?q?=E8=AF=95=E9=A2=98=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/question/Question.js | 1 + .../modules/question/component/Contentpart.js | 2 +- .../modules/question/component/Listjihe.js | 31 ++++++++++++++++--- .../question/questioncss/questioncom.css | 26 +++++++++++++++- public/react/src/modules/tpm/NewHeader.js | 3 +- 5 files changed, 56 insertions(+), 7 deletions(-) diff --git a/public/react/src/modules/question/Question.js b/public/react/src/modules/question/Question.js index 9613a4cc3..b7553311d 100644 --- a/public/react/src/modules/question/Question.js +++ b/public/react/src/modules/question/Question.js @@ -982,6 +982,7 @@ class Question extends Component { position: relative; z-index: 9999999 ; } + ` } diff --git a/public/react/src/modules/question/component/Contentpart.js b/public/react/src/modules/question/component/Contentpart.js index 516e6be1f..75fe883d6 100644 --- a/public/react/src/modules/question/component/Contentpart.js +++ b/public/react/src/modules/question/component/Contentpart.js @@ -362,7 +362,7 @@ class Contentpart extends Component { .xaxisreverseorder .ant-popover-inner-content { padding:0px !important; } - + ` } diff --git a/public/react/src/modules/question/component/Listjihe.js b/public/react/src/modules/question/component/Listjihe.js index 34d8844e7..067de710c 100644 --- a/public/react/src/modules/question/component/Listjihe.js +++ b/public/react/src/modules/question/component/Listjihe.js @@ -25,6 +25,28 @@ const tagArrays = [ 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z' ] +const questionType = [ + { + type:'SINGLE', + color:'typeGreen', + name:'单选题' + }, + { + type:'MULTIPLE', + color:'typeBlue', + name:'多选题' + }, + { + type:'JUDGMENT', + color:'typeRed', + name:'判断题' + }, + { + type:'PROGRAM', + color:'typeYellow', + name:'编程题' + } +] //Paperreview_single.js Paperlibraryseeid_items.js class Listjihe extends Component { constructor(props) { @@ -233,10 +255,10 @@ class Listjihe extends Component { }catch (e) { } - + const types = questionType.filter(item=>item.type === items.item_type); return (
    + className={chakanjiexiboolindex === keindex ? "w100s borderwds283 pd20 mb20 listjihecolors" : "borderwds pd20 mb20 listjihecolors"}> {/*顶部*/} { mydisplay===true? @@ -301,6 +323,7 @@ class Listjihe extends Component { }
    + {types && types[0].name}
    @@ -311,10 +334,10 @@ class Listjihe extends Component { { items.item_type==="PROGRAM"? this.seturls(`/problems/${items.program_attr.identifier}/edit`)} > -
    +
    : -
    +
    { items===undefined||items===null||items===""?"": items.name === undefined || items.name === null || items.name === "" ? diff --git a/public/react/src/modules/question/questioncss/questioncom.css b/public/react/src/modules/question/questioncss/questioncom.css index 096b30007..a0c791190 100644 --- a/public/react/src/modules/question/questioncss/questioncom.css +++ b/public/react/src/modules/question/questioncss/questioncom.css @@ -329,7 +329,7 @@ .listjihetixingstitsy { color: #333333; font-size: 14px; - line-height: 20px !important; + line-height: 25px !important; height: 25px !important; } @@ -1118,3 +1118,27 @@ .text-indents50{ text-indent: 50px } +.typesBtn{ + padding:0px 10px; + height:24px; + line-height:24px; + border-radius:2px; + margin-right:10px; + font-size: 13px; +} +.typeGreen{ + color:#15DB7A; + border:1px solid #15DB7A; +} +.typeBlue{ + color:#0CB9F1; + border:1px solid #0CB9F1; +} +.typeRed{ + color:#FF5555; + border:1px solid #FF5555; +} +.typeYellow{ + color:#FFB538; + border:1px solid #FFB538; +} \ No newline at end of file diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index 8d3c85378..aecee799a 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -1267,7 +1267,8 @@ submittojoinclass=(value)=>{ {/* p 老师 l 学生 */} {shixuntype===true?"":
  • 我的实训项目
  • } {pathstype===true?"":
  • {this.props.user&&this.props.user.main_site===false?"我的课程":"我的实践课程"}
  • } - {this.props.user&&this.props.user.main_site===true?
  • 我的开发项目
  • :""} + {this.props.user&&this.props.user.main_site===true?
  • 我的开发项目
  • :""} + { Periofters === true &&
  • 我的题库
  • } {/*
  • 我的众包
  • */}
  • 客户管理 From 64d78d9df73109fe5e1deea520990da5586e01b5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 6 Mar 2020 21:48:22 +0800 Subject: [PATCH 25/54] =?UTF-8?q?=E8=B7=AF=E7=94=B1=E6=94=B9=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/question/Paperreview.js | 6 +++--- .../src/modules/question/Paperreview_item.js | 2 +- .../src/modules/question/Questionitem_banks.js | 16 ++++++++-------- .../modules/question/component/Contentpart.js | 2 +- .../src/modules/question/component/Listjihe.js | 2 +- .../src/modules/question/component/SiderBars.js | 2 +- .../modules/testpaper/component/Contentpart.js | 4 ++-- .../component/Paperlibraryseeid_item.js | 2 +- .../component/Paperlibraryseeid_itemss.js | 2 +- .../modules/testpaper/component/Seeoagertits.js | 2 +- 10 files changed, 20 insertions(+), 20 deletions(-) diff --git a/public/react/src/modules/question/Paperreview.js b/public/react/src/modules/question/Paperreview.js index 425815d62..874eb9bbd 100644 --- a/public/react/src/modules/question/Paperreview.js +++ b/public/react/src/modules/question/Paperreview.js @@ -418,7 +418,7 @@ class Paperreview extends Component { artificialtype==="artificial"? 试题库 - 人工组卷 + 人工组卷 试卷预览 : @@ -429,7 +429,7 @@ class Paperreview extends Component { : - 试题库 + 试题库 新增试卷 } @@ -461,7 +461,7 @@ class Paperreview extends Component { this.setCohetepaperbool(bool)} - onSubmits={() => this.preservation()} url={ artificialtype==="artificial"?'/question':'/paperlibrary'}> + onSubmits={() => this.preservation()} url={ artificialtype==="artificial"?'/problemset':'/paperlibrary'}>
  • ) diff --git a/public/react/src/modules/question/Paperreview_item.js b/public/react/src/modules/question/Paperreview_item.js index 8f3ca4f28..a4c5e5773 100644 --- a/public/react/src/modules/question/Paperreview_item.js +++ b/public/react/src/modules/question/Paperreview_item.js @@ -463,7 +463,7 @@ class Paperreview_item extends Component { } jixuxuantioncli = () => { - this.props.history.replace("/question"); + this.props.history.replace("/problemset"); } showparagraphs = (e,name) => { diff --git a/public/react/src/modules/question/Questionitem_banks.js b/public/react/src/modules/question/Questionitem_banks.js index b70332269..aade5de2e 100644 --- a/public/react/src/modules/question/Questionitem_banks.js +++ b/public/react/src/modules/question/Questionitem_banks.js @@ -312,7 +312,7 @@ class Questionitem_banks extends Component { if (result.data.status == 0) { // this.props.showNotification(`新增单选题成功`); this.restricte=true; - this.props.history.replace('/question'); + this.props.history.replace('/problemset'); } }).catch((error) => { @@ -324,7 +324,7 @@ class Questionitem_banks extends Component { if (result.data.status == 0) { // this.props.showNotification(`编辑单选题成功`); this.restricte=true; - this.props.history.replace('/question'); + this.props.history.replace('/problemset'); } @@ -392,7 +392,7 @@ class Questionitem_banks extends Component { if (result.data.status == 0) { // this.props.showNotification(`新增多选题成功`); this.restricte=true; - this.props.history.replace('/question'); + this.props.history.replace('/problemset'); } @@ -406,7 +406,7 @@ class Questionitem_banks extends Component { if (result.data.status == 0) { // this.props.showNotification(`编辑多选题成功`); this.restricte=true; - this.props.history.replace('/question'); + this.props.history.replace('/problemset'); } @@ -461,7 +461,7 @@ class Questionitem_banks extends Component { if (result.data.status == 0) { // this.props.showNotification(`新增判断题成功`); this.restricte=true; - this.props.history.replace('/question'); + this.props.history.replace('/problemset'); } }).catch((error) => { @@ -474,7 +474,7 @@ class Questionitem_banks extends Component { if (result.data.status == 0) { // this.props.showNotification(`编辑判断题成功`); this.restricte=true; - this.props.history.replace('/question'); + this.props.history.replace('/problemset'); } }).catch((error) => { @@ -561,7 +561,7 @@ class Questionitem_banks extends Component {
    - 试题库 + 试题库 {JSON.stringify(params) === "{}" ? "新增" : "编辑"}试题
    @@ -627,7 +627,7 @@ class Questionitem_banks extends Component { "" : this.preservation()} url={'/question'}> + onSubmits={() => this.preservation()} url={'/problemset'}> }
    ) diff --git a/public/react/src/modules/question/component/Contentpart.js b/public/react/src/modules/question/component/Contentpart.js index 449e0e9e4..f8e2ee400 100644 --- a/public/react/src/modules/question/component/Contentpart.js +++ b/public/react/src/modules/question/component/Contentpart.js @@ -201,7 +201,7 @@ class Contentpart extends Component { } - this.props.history.push("/question/newitem?pages="+this.props.pages+urls); + this.props.history.push("/problemset/newitem?pages="+this.props.pages+urls); } render() { diff --git a/public/react/src/modules/question/component/Listjihe.js b/public/react/src/modules/question/component/Listjihe.js index 34d8844e7..14652cdef 100644 --- a/public/react/src/modules/question/component/Listjihe.js +++ b/public/react/src/modules/question/component/Listjihe.js @@ -495,7 +495,7 @@ class Listjihe extends Component { this.props.Isitapopup&&this.props.Isitapopup==="true"? "" : - this.seturls(`/question/edit/${items.id}`)}> + this.seturls(`/problemset/edit/${items.id}`)}>

    编辑 diff --git a/public/react/src/modules/question/component/SiderBars.js b/public/react/src/modules/question/component/SiderBars.js index e6cee7761..724ae7f79 100644 --- a/public/react/src/modules/question/component/SiderBars.js +++ b/public/react/src/modules/question/component/SiderBars.js @@ -117,7 +117,7 @@ class SiderBars extends Component { {this.props.mygetHelmetapi&&this.props.mygetHelmetapi.main_site===true?

    { - mypath&&mypath==="/question"&&swsilan===true? + mypath&&mypath==="/problemset"&&swsilan===true?
    this.props.showDrawer()} > diff --git a/public/react/src/modules/testpaper/component/Contentpart.js b/public/react/src/modules/testpaper/component/Contentpart.js index 5148e00ca..3f86a30f9 100644 --- a/public/react/src/modules/testpaper/component/Contentpart.js +++ b/public/react/src/modules/testpaper/component/Contentpart.js @@ -73,7 +73,7 @@ class Contentpart extends Component { } //跳转人工组卷 Mantegeneration=()=>{ - this.props.history.push('/question'); + this.props.history.push('/problemset'); } @@ -375,7 +375,7 @@ class Contentpart extends Component {
    - this.xinzenw('/question')}> + this.xinzenw('/problemset')}>

    人工组卷

    diff --git a/public/react/src/modules/testpaper/component/Paperlibraryseeid_item.js b/public/react/src/modules/testpaper/component/Paperlibraryseeid_item.js index 06298299f..58959d745 100644 --- a/public/react/src/modules/testpaper/component/Paperlibraryseeid_item.js +++ b/public/react/src/modules/testpaper/component/Paperlibraryseeid_item.js @@ -286,7 +286,7 @@ class Paperreview_item extends Component { } jixuxuantioncli = () => { - this.props.history.replace("/question"); + this.props.history.replace("/problemset"); } showparagraphs = (e,name) => { diff --git a/public/react/src/modules/testpaper/component/Paperlibraryseeid_itemss.js b/public/react/src/modules/testpaper/component/Paperlibraryseeid_itemss.js index 754a45560..2cdc60623 100644 --- a/public/react/src/modules/testpaper/component/Paperlibraryseeid_itemss.js +++ b/public/react/src/modules/testpaper/component/Paperlibraryseeid_itemss.js @@ -361,7 +361,7 @@ class Paperlibraryseeid_itemss extends Component { } jixuxuantioncli = () => { - this.props.history.replace("/question"); + this.props.history.replace("/problemset"); } showparagraphs = (e,name) => { diff --git a/public/react/src/modules/testpaper/component/Seeoagertits.js b/public/react/src/modules/testpaper/component/Seeoagertits.js index a983bd67e..573655a63 100644 --- a/public/react/src/modules/testpaper/component/Seeoagertits.js +++ b/public/react/src/modules/testpaper/component/Seeoagertits.js @@ -26,7 +26,7 @@ class Seeoagertit extends Component { onChange=(e)=> { } jixuxuantioncli = () => { - this.props.history.replace("/question"); + this.props.history.replace("/problemset"); } render() { From 9ebaedf84a0805d8c61f8b0e48f5a5f0a279ff50 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 6 Mar 2020 21:50:11 +0800 Subject: [PATCH 26/54] =?UTF-8?q?=E8=B7=AF=E7=94=B1=E6=94=B9=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/App.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/public/react/src/App.js b/public/react/src/App.js index 4c4908771..947cf51a5 100644 --- a/public/react/src/App.js +++ b/public/react/src/App.js @@ -807,16 +807,16 @@ class App extends Component { render={ (props) => () } /> - () } /> - () } /> - () } /> @@ -835,7 +835,7 @@ class App extends Component { (props) => () }/> - () }/> From 720dd7bdf1e9f5933179c75537429bcc5e3b06aa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 6 Mar 2020 21:51:02 +0800 Subject: [PATCH 27/54] =?UTF-8?q?=E8=B7=AF=E7=94=B1=E6=94=B9=E5=8A=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/TPMIndexHOC.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/tpm/TPMIndexHOC.js b/public/react/src/modules/tpm/TPMIndexHOC.js index 9ba60c27a..a5da90e2c 100644 --- a/public/react/src/modules/tpm/TPMIndexHOC.js +++ b/public/react/src/modules/tpm/TPMIndexHOC.js @@ -769,7 +769,7 @@ export function TPMIndexHOC(WrappedComponent) { {...this.dialogObj} />:""} { - mypath&&mypath==="/question"? + mypath&&mypath==="/problemset"? "" : Date: Fri, 6 Mar 2020 21:55:21 +0800 Subject: [PATCH 28/54] =?UTF-8?q?=E9=9A=90=E8=97=8F=E6=99=BA=E8=83=BD?= =?UTF-8?q?=E7=BB=84=E5=8D=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../testpaper/component/Contentpart.js | 22 ++++++++++++------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/public/react/src/modules/testpaper/component/Contentpart.js b/public/react/src/modules/testpaper/component/Contentpart.js index 3f86a30f9..f5c0a5cb4 100644 --- a/public/react/src/modules/testpaper/component/Contentpart.js +++ b/public/react/src/modules/testpaper/component/Contentpart.js @@ -368,18 +368,24 @@ class Contentpart extends Component {
    - - this.xinzenw('/Integeneration')}> -
    -

    智能组卷

    -
    -
    - this.xinzenw('/problemset')}> - :"" } From c26a13cb1807e220ebeb6a53ed51b5ccc51729e7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 6 Mar 2020 22:18:19 +0800 Subject: [PATCH 29/54] =?UTF-8?q?=E9=9A=90=E8=97=8F=E6=99=BA=E8=83=BD?= =?UTF-8?q?=E7=BB=84=E5=8D=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/question/Paperreview.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/public/react/src/modules/question/Paperreview.js b/public/react/src/modules/question/Paperreview.js index 874eb9bbd..273b53a0f 100644 --- a/public/react/src/modules/question/Paperreview.js +++ b/public/react/src/modules/question/Paperreview.js @@ -236,7 +236,8 @@ class Paperreview extends Component { .then((result) => { if (result.data.status === 0) { // this.props.showNotification(`组卷成功`); - this.props.history.replace('/paperlibrary'); + // console.log(result.data.exam_id); + this.props.history.replace('/paperlibrary/see/'+result.data.exam_id); } }).catch((error) => { //console.log(error); From 3b933c1be905aed76274d12b7f876870fba2e0e2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 6 Mar 2020 22:18:46 +0800 Subject: [PATCH 30/54] =?UTF-8?q?=E9=9A=90=E8=97=8F=E6=99=BA=E8=83=BD?= =?UTF-8?q?=E7=BB=84=E5=8D=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/question/Paperreview.js | 1 + 1 file changed, 1 insertion(+) diff --git a/public/react/src/modules/question/Paperreview.js b/public/react/src/modules/question/Paperreview.js index 273b53a0f..f40ad9519 100644 --- a/public/react/src/modules/question/Paperreview.js +++ b/public/react/src/modules/question/Paperreview.js @@ -237,6 +237,7 @@ class Paperreview extends Component { if (result.data.status === 0) { // this.props.showNotification(`组卷成功`); // console.log(result.data.exam_id); + //本来调试卷库首页的 this.props.history.replace('/paperlibrary/see/'+result.data.exam_id); } }).catch((error) => { From 0f2b00d014c80a9bd643e2b3255b21fb6724f128 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 6 Mar 2020 22:21:50 +0800 Subject: [PATCH 31/54] =?UTF-8?q?=E8=B0=83=E6=95=B4=E6=A0=B7=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/question/questioncss/questioncom.css | 10 +++++----- .../src/modules/testpaper/testioncss/testioncss.css | 6 +++--- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/public/react/src/modules/question/questioncss/questioncom.css b/public/react/src/modules/question/questioncss/questioncom.css index a0c791190..d5ac90d12 100644 --- a/public/react/src/modules/question/questioncss/questioncom.css +++ b/public/react/src/modules/question/questioncss/questioncom.css @@ -419,10 +419,10 @@ color: #4CACFF; } .xiaoshou{ - cursor:pointer; + cursor:pointer !important; } .xiaoshout{ - cursor:default; + cursor:default !important; } .mt40{ margin-top: 40px; @@ -1129,7 +1129,7 @@ .typeGreen{ color:#15DB7A; border:1px solid #15DB7A; -} +} .typeBlue{ color:#0CB9F1; border:1px solid #0CB9F1; @@ -1137,8 +1137,8 @@ .typeRed{ color:#FF5555; border:1px solid #FF5555; -} +} .typeYellow{ color:#FFB538; border:1px solid #FFB538; -} \ No newline at end of file +} diff --git a/public/react/src/modules/testpaper/testioncss/testioncss.css b/public/react/src/modules/testpaper/testioncss/testioncss.css index 56c2e36c0..8c9597ed0 100644 --- a/public/react/src/modules/testpaper/testioncss/testioncss.css +++ b/public/react/src/modules/testpaper/testioncss/testioncss.css @@ -400,13 +400,13 @@ color: #4CACFF; } .xiaoshou{ - cursor:pointer; + cursor:pointer !important; } .xiaoshout{ - cursor:default; + cursor:default !important; } .shubiao{ - cursor:default; + cursor:default !important; } .mt40{ margin-top: 40px; From bf3a8fb7af37a1f62e2526ed4ae38d64d1905245 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 6 Mar 2020 22:44:47 +0800 Subject: [PATCH 32/54] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/modals/Bottomsubmit.js | 10 +++++++--- public/react/src/modules/question/Paperreview.js | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/public/react/src/modules/modals/Bottomsubmit.js b/public/react/src/modules/modals/Bottomsubmit.js index 187910cb9..22fb7c8fd 100644 --- a/public/react/src/modules/modals/Bottomsubmit.js +++ b/public/react/src/modules/modals/Bottomsubmit.js @@ -12,9 +12,13 @@ class Bottomsubmit extends Component { cannelfun = () => { // window.location.href= - if(this.props.Cohetepaperbool===true){ - this.props.setCohetepaperbool(false); - }else { + try { + if(this.props.Cohetepaperbool===true){ + this.props.setCohetepaperbool(false); + }else { + this.props.history.replace(this.props.url); + } + }catch (e) { this.props.history.replace(this.props.url); } diff --git a/public/react/src/modules/question/Paperreview.js b/public/react/src/modules/question/Paperreview.js index f40ad9519..fadba71ca 100644 --- a/public/react/src/modules/question/Paperreview.js +++ b/public/react/src/modules/question/Paperreview.js @@ -463,6 +463,7 @@ class Paperreview extends Component { this.setCohetepaperbool(bool)} + Cohetepaperbool={this.state.Cohetepaperbool} onSubmits={() => this.preservation()} url={ artificialtype==="artificial"?'/problemset':'/paperlibrary'}>
    ) From cdfd060d39b420f52736ff1103e59c9aa93aade6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 6 Mar 2020 22:52:33 +0800 Subject: [PATCH 33/54] =?UTF-8?q?=E8=B0=83=E6=95=B4=E9=A2=84=E8=A7=88?= =?UTF-8?q?=E9=A1=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/question/Question.js | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/public/react/src/modules/question/Question.js b/public/react/src/modules/question/Question.js index b7553311d..81d70bdb3 100644 --- a/public/react/src/modules/question/Question.js +++ b/public/react/src/modules/question/Question.js @@ -940,6 +940,15 @@ class Question extends Component { return (
    + { mydisplay===true? @@ -966,11 +975,7 @@ class Question extends Component { :"" } - { - visible===true? +
    - :""} { modalsTypes===true? this.modalCancels()} From 926339043d447d36f21694dd27fadae94bfb3fda Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 6 Mar 2020 22:57:25 +0800 Subject: [PATCH 34/54] =?UTF-8?q?=E9=A2=98=E5=BA=93=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/developer/newOrEditTask/index.js | 38 +++++++++---------- .../modules/developer/studentStudy/index.js | 2 +- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/public/react/src/modules/developer/newOrEditTask/index.js b/public/react/src/modules/developer/newOrEditTask/index.js index 565d6af30..b95668413 100644 --- a/public/react/src/modules/developer/newOrEditTask/index.js +++ b/public/react/src/modules/developer/newOrEditTask/index.js @@ -1,7 +1,7 @@ /* * @Description: 新建或编辑任务 - * @Author: tangjiang - * @Date: 2019-11-15 16:38:34 + * @Author: tangjiang + * @Date: 2019-11-15 16:38:34 * @Last Modified by: tangjiang * @Last Modified time: 2019-11-19 23:23:41 */ @@ -20,7 +20,7 @@ import actions from '../../../redux/actions'; // import {ModalConfirm} from '../../../common/components/ModalConfirm'; const NewOrEditTask = (props) => { - const { + const { publishLoading, handlePublish, // testCases = [], @@ -41,7 +41,7 @@ const NewOrEditTask = (props) => { courseQuestions // updateTestAndValidate, } = props; - + // 表单提交 const handleSubmitForm = () => { // 改变loading状态 @@ -53,7 +53,7 @@ const NewOrEditTask = (props) => { props.handleFormSubmit(props); // 提交表单 } }; - + useEffect(() => { // 获取用户信息 getUserInfoForNew(); @@ -121,7 +121,7 @@ const NewOrEditTask = (props) => { // 清空描述信息 toStore('oj_description', ''); // props.history.push('/problems'); - props.history.push(`/question?${props.searchParams}`); + props.history.push(`/problemset?${props.searchParams}`); } // 发布 @@ -163,8 +163,8 @@ const NewOrEditTask = (props) => { onClick={handleClickCancel} style={{ background: '#666666', color: '#fff', border: 'none' }} >取消 - @@ -174,14 +174,14 @@ const NewOrEditTask = (props) => { // 发布/模拟挑战 const renderPubOrFight = () => { const pubButton = isPublish - ? () - : (); @@ -191,13 +191,13 @@ const NewOrEditTask = (props) => { ) : ( ); - + if (isPublish) { return ( {pubButton} - @@ -207,8 +207,8 @@ const NewOrEditTask = (props) => { } else { return ( - @@ -217,7 +217,7 @@ const NewOrEditTask = (props) => { ); } - + } // 渲染退出 @@ -296,7 +296,7 @@ const mapDispatchToProps = (dispatch) => ({ clearOJFormStore: () => dispatch(actions.clearOJFormStore()), // 按钮状态 changeSubmitLoadingStatus: (flag) => dispatch(actions.changeSubmitLoadingStatus(flag)), - // 发布按钮状态 + // 发布按钮状态 changePublishLoadingStatus: (flag) => dispatch(actions.changePublishLoadingStatus(flag)), // 测试用例及验证 updateTestAndValidate: (obj) => dispatch(actions.updateTestAndValidate(obj)), diff --git a/public/react/src/modules/developer/studentStudy/index.js b/public/react/src/modules/developer/studentStudy/index.js index 2af70efdf..e6a11482c 100644 --- a/public/react/src/modules/developer/studentStudy/index.js +++ b/public/react/src/modules/developer/studentStudy/index.js @@ -129,7 +129,7 @@ function StudentStudy (props) { changeShowOrHideControl(false); props.saveEditorCodeForDetail(''); // props.history.push('/problems'); - props.history.push(`/question?${searchParams}`); + props.history.push(`/problemset?${searchParams}`); } return ( From 05c22c1615fc3a2173530ab84636165c6d79b228 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 6 Mar 2020 23:21:36 +0800 Subject: [PATCH 35/54] =?UTF-8?q?=E9=A2=98=E5=BA=93=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/redux/actions/ojForUser.js | 32 ++++++++++----------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/public/react/src/redux/actions/ojForUser.js b/public/react/src/redux/actions/ojForUser.js index 87c877fa5..934d12e49 100644 --- a/public/react/src/redux/actions/ojForUser.js +++ b/public/react/src/redux/actions/ojForUser.js @@ -1,17 +1,17 @@ /* - * @Description: + * @Description: * @Author: tangjiang - * @Github: + * @Github: * @Date: 2019-11-27 13:42:11 * @LastEditors : tangjiang * @LastEditTime : 2020-02-10 18:17:00 */ import types from "./actionTypes"; import { Base64 } from 'js-base64'; -import { +import { fetchStartProgram, fetchUserProgramDetail, - fetchDebuggerCode, + fetchDebuggerCode, fetchCodeSubmit, fetchUserCommitRecord, fetchUserCommitRecordDetail, @@ -50,7 +50,7 @@ export const startProgramQuestion = (id, props) => { // console.log(path); // props.history.push(`/myproblems/${identifier}`); props.history.push({ - pathname: `/myproblems/${identifier}?${searchParams}`, + pathname: `/myproblems/${identifier}.json?${searchParams}`, }); } } @@ -90,7 +90,7 @@ export const getUserProgramDetail = (identifier, type) => { type: types.SAVE_USE_TEST_CASE_VALUE, payload: data.test_case || {} }); - // 代码是否更新 + // 代码是否更新 let _modify_code = false; if (data.hack) { _modify_code = data.hack.modify_code; @@ -145,7 +145,7 @@ export const saveUserCodeForInterval = (identifier, code) => { /** * @description 保存或更新之前先更新代码 - * @param {*} identifier + * @param {*} identifier * @param {*} inputValue 输入值: 自定义 | 系统返回的 * @param {*} type 测评类型 debug | submit */ @@ -157,7 +157,7 @@ export const updateCode = (identifier, inputValue, type) => { fetchUpdateCode(identifier, { code: Base64.encode(userCode) }).then(res => { - // 是否更新了代码, 目的是当代码没有更新时不调用更新代码接口,目录没有实现 + // 是否更新了代码, 目的是当代码没有更新时不调用更新代码接口,目录没有实现 // TODO 需要优化 if (res.data.status === 401) { dispatch({ // 改变 loading 值 @@ -187,7 +187,7 @@ export const codeEvaluate = (dispatch, identifier, type, time_limit, hackStatus, let count = 1; /** * @param {*} excuteTime 执行时间 - * @param {*} finalTime 总时间 + * @param {*} finalTime 总时间 * @param {*} count 执行次数 * @param {*} timer 定时器 */ @@ -199,7 +199,7 @@ export const codeEvaluate = (dispatch, identifier, type, time_limit, hackStatus, if (+status === 0 || (excuteTime / 1000) > (finalTime + 1)) { clearInterval(timer); // 清除定时器 timer = null; - let returnData = null; + let returnData = null; if (status === 1) { // 结果没有返回 returnData = { error_line: -1, @@ -221,7 +221,7 @@ export const codeEvaluate = (dispatch, identifier, type, time_limit, hackStatus, payload: { type, data: returnData - } + } }); if (!type || type === 'debug') { dispatch({ // 改变 loading 值 @@ -287,13 +287,13 @@ export const codeEvaluate = (dispatch, identifier, type, time_limit, hackStatus, /** * @description 调试代码 - * @param {*} identifier + * @param {*} identifier * @param {*} inputValue 输入值: 自定义 | 系统返回的 * @param {*} type 测评类型 debug | submit */ export const debuggerCode = (identifier,value, type) => { return (dispatch, getState) => { - // 调用之前 先保存 code + // 调用之前 先保存 code // TODO // console.log(identifier, value); const { hack } = getState().ojForUserReducer; @@ -398,7 +398,7 @@ export const changeUserCodeTab = (key) => { /** * @description 用户提交代码, 先调用保存代码接口,再调提交接口,成功后调用调试接口 - * @param {*} identifier + * @param {*} identifier */ export const submitUserCode = (identifier, inputValue, type) => { return (dispatch, getState) => { @@ -430,7 +430,7 @@ export const submitUserCode = (identifier, inputValue, type) => { fetchUpdateCode(identifier, { code: userCode }).then(res => { - // 是否更新了代码, 目的是当代码没有更新时不调用更新代码接口,目录没有实现 + // 是否更新了代码, 目的是当代码没有更新时不调用更新代码接口,目录没有实现 // TODO 需要优化 if (res.data.status === 401) { dispatch({ @@ -495,7 +495,7 @@ export const saveOpacityType = (type) => { type: types.CLICK_OPERATE_TYPE, payload: type } -} +} export const clearOjForUserReducer = () => { From 1c6f1c412379693c6abb4dea4173d472af6bc6d8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Fri, 6 Mar 2020 23:25:17 +0800 Subject: [PATCH 36/54] =?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/scripts/build.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/scripts/build.js b/public/react/scripts/build.js index aafa2e765..f8cec6702 100644 --- a/public/react/scripts/build.js +++ b/public/react/scripts/build.js @@ -221,7 +221,7 @@ function generateNewIndexJsp() { // var result = data .replace(jsMinAllRegex, code) - .replace(flvMinAllRegex) + .replace(flvMinAllRegex,'') // .replace('/js/js_min_all.js', `${cdnHost}/react/build/js/js_min_all.js?v=${newVersion}`) // .replace('/js/js_min_all_2.js', `${cdnHost}/react/build/js/js_min_all_2.js?v=${newVersion}`) From 2b7caa76abe0acff7f56bb839f6b99f91063df4c Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 6 Mar 2020 23:42:49 +0800 Subject: [PATCH 37/54] =?UTF-8?q?=E6=B4=BB=E8=82=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/static_all.rake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/tasks/static_all.rake b/lib/tasks/static_all.rake index 58a11572d..4db09001e 100644 --- a/lib/tasks/static_all.rake +++ b/lib/tasks/static_all.rake @@ -2,7 +2,7 @@ desc "统计每个学校使用数据" namespace :static_all do task :repo => :environment do - school_alls = School.includes(courses: [:homework_commons, :attachments, :course_videos], user_extensions: :user).where(id: 117) + school_alls = School.includes(courses: [:homework_commons, :attachments, :course_videos], user_extensions: :user).all proc_num = ENV['processes'].blank? ? 5 : ENV['processes'].to_i school_alls.find_in_batches(batch_size: 50) do |schools| Parallel.each(schools, in_processes: proc_num) do |school| From d0dd909c992acd966ed7bbf790476437d5957705 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 6 Mar 2020 23:43:10 +0800 Subject: [PATCH 38/54] =?UTF-8?q?=E5=8E=BB=E9=99=A4=E9=99=90=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/hack_set.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/hack_set.rb b/app/models/hack_set.rb index 2c21c3c22..fb37f398c 100644 --- a/app/models/hack_set.rb +++ b/app/models/hack_set.rb @@ -1,7 +1,7 @@ class HackSet < ApplicationRecord validates_length_of :input, maximum: 1000, message: "不能超过1000个字符" validates_length_of :output, maximum: 1000, message: "不能超过1000个字符" - validates :input, presence: { message: "测试集输入不能为空" } + #validates :input, presence: { message: "测试集输入不能为空" } validates :output, presence: { message: "测试集输出不能为空" } validates_uniqueness_of :input, scope: [:hack_id, :input], message: "多个测试集的输入不能相同" # 编程题测试集 From 40c53128f2bf538c0600ff66651a0973884094d5 Mon Sep 17 00:00:00 2001 From: caicai8 <1149225589@qq.com> Date: Fri, 6 Mar 2020 23:44:01 +0800 Subject: [PATCH 39/54] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E8=AF=BE=E5=A0=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/courses/coursesPublic/Addcourses.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/public/react/src/modules/courses/coursesPublic/Addcourses.js b/public/react/src/modules/courses/coursesPublic/Addcourses.js index fb0a8a920..db0f9afd6 100644 --- a/public/react/src/modules/courses/coursesPublic/Addcourses.js +++ b/public/react/src/modules/courses/coursesPublic/Addcourses.js @@ -275,12 +275,13 @@ class Addcourses extends Component{ }); if(response.data.course_id!=undefined){ this.submitasyn(response.data.course_id) - }else{ - // 无返回课程id则是选择的教师或者助教身份,成功后跳转到课堂首页 - // console.log(this.props); - // console.log(this.props.history.push); - window.location.href="/courses"; } + // else{ + // // 无返回课程id则是选择的教师或者助教身份,成功后跳转到课堂首页 + // // console.log(this.props); + // // console.log(this.props.history.push); + // window.location.href="/courses"; + // } if(Addcoursestype===true){ this.props.hideAddcoursestype(); } From 122d7dc2489cb822042877014748f2662adce28c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 6 Mar 2020 23:45:45 +0800 Subject: [PATCH 40/54] =?UTF-8?q?=E9=A2=98=E5=BA=93=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/tpm/NewHeader.js | 3 ++- public/react/src/redux/actions/ojForUser.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index aecee799a..99018567c 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -1268,7 +1268,8 @@ submittojoinclass=(value)=>{ {shixuntype===true?"":
  • 我的实训项目
  • } {pathstype===true?"":
  • {this.props.user&&this.props.user.main_site===false?"我的课程":"我的实践课程"}
  • } {this.props.user&&this.props.user.main_site===true?
  • 我的开发项目
  • :""} - { Periofters === true &&
  • 我的题库
  • } + { Periofters === true &&
  • 我的试题库
  • } + { Periofters === true &&
  • 我的试卷库
  • } {/*
  • 我的众包
  • */}
  • 客户管理 diff --git a/public/react/src/redux/actions/ojForUser.js b/public/react/src/redux/actions/ojForUser.js index 934d12e49..87405f43d 100644 --- a/public/react/src/redux/actions/ojForUser.js +++ b/public/react/src/redux/actions/ojForUser.js @@ -50,7 +50,7 @@ export const startProgramQuestion = (id, props) => { // console.log(path); // props.history.push(`/myproblems/${identifier}`); props.history.push({ - pathname: `/myproblems/${identifier}.json?${searchParams}`, + pathname: `/myproblems/${identifier}${searchParams}`, }); } } From 8f5b1dea42afa05ca53107156a105ea2cfe1b0a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Sat, 7 Mar 2020 00:01:15 +0800 Subject: [PATCH 41/54] =?UTF-8?q?=E9=A2=98=E5=BA=93=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../leftpane/editorTab/AddTestDemo.js | 18 +++++++----------- 1 file changed, 7 insertions(+), 11 deletions(-) diff --git a/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/AddTestDemo.js b/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/AddTestDemo.js index a16f30c18..e3cb54781 100644 --- a/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/AddTestDemo.js +++ b/public/react/src/modules/developer/newOrEditTask/leftpane/editorTab/AddTestDemo.js @@ -1,7 +1,7 @@ /* * @Description: 添加测试用例 * @Author: tangjiang - * @Github: + * @Github: * @Date: 2019-11-21 09:19:38 * @LastEditors : tangjiang * @LastEditTime : 2019-12-27 10:37:41 @@ -19,14 +19,14 @@ const AddTestDemo = (props) => { const { // key, // onSubmitTest, - onDeleteTest, + onDeleteTest, testCase, testCaseValidate, isOpen } = props; // const [isEditor, setIsEditor] = useState(false); // 是否是编辑 - + // 删除操作 const handleDeletePanel = (e) => { // console.log('点击的删除按钮') @@ -63,7 +63,7 @@ const AddTestDemo = (props) => { const value = e.target.value; testCaseOutputChange(value, index); } - + // 右侧删除图标 const genExtra = () => ( { * 文本输入框可编辑的情况 * 1. 新增时 * 2. isAdd 为 false 且 isEditor 为true 时 - * @param {*} testCase + * @param {*} testCase */ // const isDisabled = (testCase) => { // return !testCase.isAdd && !isEditor; @@ -138,21 +138,19 @@ const AddTestDemo = (props) => { // defaultActiveKey: [isOpen ? '1' : ''] // }; // console.log(activePane); - + // 切换手风琴 const handleChangeCollapse = () => { const {index, updateOpenTestCaseIndex} = props; updateOpenTestCaseIndex(index); } - + return ( handleChangeCollapse()}>
    输入} - validateStatus={testCaseValidate.input.validateStatus} - help={testCaseValidate.input.errMsg} colon={ false } >