From 777736d47f020a373424db1234c7092d906aa39f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 13 Aug 2019 17:26:55 +0800 Subject: [PATCH 01/11] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shixunHomework/ShixunStudentWork.js | 19 ++++++++----------- 1 file changed, 8 insertions(+), 11 deletions(-) diff --git a/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js b/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js index 1041bb284..299090a22 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js @@ -153,19 +153,16 @@ class ShixunStudentWork extends Component { } this.setState({ data: response.data, - datalist:datas + datalist:datas, + lunxun:false, }); + }else { + setInterval(() => { + if(this.state.lunxun===true){ + this.getupdata(); + } + }, 5000); } - this.setState({ - lunxun:false, - }) - }else{ - setInterval(() => { - if(this.state.lunxun===true){ - this.getupdata(); - } - }, 1000); - } } From d3ad02535ab67c9ec20c89ccc7bc3a768dd30681 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 13 Aug 2019 17:58:06 +0800 Subject: [PATCH 02/11] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../shixunHomework/ShixunStudentWork.js | 61 ++++++++++++++++--- 1 file changed, 54 insertions(+), 7 deletions(-) diff --git a/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js b/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js index 299090a22..0c2e528c5 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js @@ -156,12 +156,6 @@ class ShixunStudentWork extends Component { datalist:datas, lunxun:false, }); - }else { - setInterval(() => { - if(this.state.lunxun===true){ - this.getupdata(); - } - }, 5000); } } } @@ -182,7 +176,13 @@ class ShixunStudentWork extends Component { description: response.data.message }); } - + setInterval(() => { + console.log("开始轮询了"); + if(this.state.lunxun===true){ + console.log("开始轮询了getupdata"); + this.getupdatasysk(); + } + }, 5000); }).catch((error) => { @@ -194,6 +194,53 @@ class ShixunStudentWork extends Component { this.setState({ shixuntypes:type[3] }) + }; + getupdatasysk=(pages)=>{ + let {order,b_order,page,limit,group_infolist,search}=this.state; + + var homeworkid = this.props.match.params.homeworkid; + let url = "/homework_commons/" + homeworkid + "/code_review_results.json"; + + axios.get(url,{params:{ + order:order, + sort:b_order, + page:pages===undefined?page:pages, + limit:limit, + group_ids:group_infolist, + search:search + }, + paramsSerializer: function(params) { + return qs.stringify(params, {arrayFormat: 'brackets'}) + }}).then((response) => { + if (response.data.status === undefined || response.data.status === 0) { + if(response.data!=undefined){ + if(response.data.status!=-2){ + let datas=[]; + let list=response.data.users_reviews; + for(var i=0; i { + console.log(error) + }); + + } getcode_review_results=(order,b_order,page,limit,group_infolist,search)=>{ From c6a41cc34847600a578566c06d836f8fef0d6edd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 13 Aug 2019 18:04:41 +0800 Subject: [PATCH 03/11] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/shixunHomework/shixunreport/Shixunechart.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/courses/shixunHomework/shixunreport/Shixunechart.js b/public/react/src/modules/courses/shixunHomework/shixunreport/Shixunechart.js index 9842aa026..8d9fc870a 100644 --- a/public/react/src/modules/courses/shixunHomework/shixunreport/Shixunechart.js +++ b/public/react/src/modules/courses/shixunHomework/shixunreport/Shixunechart.js @@ -370,7 +370,7 @@ class Shixunechart extends Component {
  • {data&&data.username}
  • -
  • {data&&data.student_id}
  • +
  • {data!==undefined?"":data.student_id===undefined?"":data.student_id===null?"":data.student_id}
  • {data&&data.echart_data===undefined?"":data&&data.echart_data.myself_eff[1]}
  • {data&&data.echart_data===undefined?"":data&&data.echart_data.myself_eff[0]}
  • @@ -396,7 +396,7 @@ class Shixunechart extends Component {
  • {data&&data.username}
  • -
  • {data&&data.student_id}
  • +
  • {data!==undefined?"":data.student_id===undefined?"":data.student_id===null?"":data.student_id}
  • {data&&data.echart_data===undefined?"":data&&data.echart_data.myself_object[1]}
  • From 885e2175cf86e7c6e81b5d4be951dc7962b60121 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Tue, 13 Aug 2019 18:06:55 +0800 Subject: [PATCH 04/11] =?UTF-8?q?=E9=87=91=E8=AF=BE=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E5=90=8C=E6=AD=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 2 +- lib/tasks/publick_course.rake | 25 +++++++++++++++++++++++ 2 files changed, 26 insertions(+), 1 deletion(-) create mode 100644 lib/tasks/publick_course.rake diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index db6ae7b57..49fe9ca50 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -239,7 +239,7 @@ class ApplicationController < ActionController::Base uid_logger("user_setup: " + (User.current.logged? ? "#{User.current.try(:login)} (id=#{User.current.try(:id)})" : "anonymous")) if !User.current.logged? && Rails.env.development? - User.current = User.find 57703 + User.current = User.find 12 end diff --git a/lib/tasks/publick_course.rake b/lib/tasks/publick_course.rake new file mode 100644 index 000000000..fbae02107 --- /dev/null +++ b/lib/tasks/publick_course.rake @@ -0,0 +1,25 @@ +#coding=utf-8 +# 执行示例 bundle exec rake public_course:student args=1,2 +# args 第一个参数是subject_id,第二个参数是课程course_id + +desc "同步精品课数据" +namespace :public_course do + task :student => :environment do + + + subject_id = ENV['args'].split(",").first + course_id = ENV['args'].split(",").last + puts "subject_id is #{subject_id}" + puts "course_id is #{course_id}" + + user_ids = Myshixun.find_by_sql("select user_id from myshixuns where shixun_id in (select shixun_id from stage_shixuns + where stage_id in (select id from stages where subject_id=1))").try(:user_id) + puts user_ids + if user_ids.present? + user_ids.each do |user_id| + puts user_id + CourseMember.create!(course_id: course_id, user_id: user_id, role: 4) + end + end + end +end \ No newline at end of file From 5fa82b0fec67ec5e4d2a12a125ea9104550e98aa Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Tue, 13 Aug 2019 18:07:23 +0800 Subject: [PATCH 05/11] =?UTF-8?q?=E7=94=A8=E6=88=B7=E6=B5=8B=E8=AF=95?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 49fe9ca50..db6ae7b57 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -239,7 +239,7 @@ class ApplicationController < ActionController::Base uid_logger("user_setup: " + (User.current.logged? ? "#{User.current.try(:login)} (id=#{User.current.try(:id)})" : "anonymous")) if !User.current.logged? && Rails.env.development? - User.current = User.find 12 + User.current = User.find 57703 end From 8e0adec7bda7a7b606734ed9dee392a55c0f43e9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 13 Aug 2019 18:09:10 +0800 Subject: [PATCH 06/11] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/shixunHomework/shixunreport/Shixunechart.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/courses/shixunHomework/shixunreport/Shixunechart.js b/public/react/src/modules/courses/shixunHomework/shixunreport/Shixunechart.js index 8d9fc870a..d19835f3b 100644 --- a/public/react/src/modules/courses/shixunHomework/shixunreport/Shixunechart.js +++ b/public/react/src/modules/courses/shixunHomework/shixunreport/Shixunechart.js @@ -370,7 +370,7 @@ class Shixunechart extends Component {
  • {data&&data.username}
  • -
  • {data!==undefined?"":data.student_id===undefined?"":data.student_id===null?"":data.student_id}
  • +
  • {data!==undefined?"无":data.student_id===undefined?"无":data.student_id===null?"无":data.student_id}
  • {data&&data.echart_data===undefined?"":data&&data.echart_data.myself_eff[1]}
  • {data&&data.echart_data===undefined?"":data&&data.echart_data.myself_eff[0]}
  • @@ -396,7 +396,7 @@ class Shixunechart extends Component {
  • {data&&data.username}
  • -
  • {data!==undefined?"":data.student_id===undefined?"":data.student_id===null?"":data.student_id}
  • +
  • {data!==undefined?"无":data.student_id===undefined?"无":data.student_id===null?"无":data.student_id}
  • {data&&data.echart_data===undefined?"":data&&data.echart_data.myself_object[1]}
  • From ea92892f07e261f0ede7b17734162e04bbb6df39 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Tue, 13 Aug 2019 18:14:42 +0800 Subject: [PATCH 07/11] =?UTF-8?q?rake=20=E4=BB=BB=E5=8A=A1?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lib/tasks/publick_course.rake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/tasks/publick_course.rake b/lib/tasks/publick_course.rake index fbae02107..20a9a5d3a 100644 --- a/lib/tasks/publick_course.rake +++ b/lib/tasks/publick_course.rake @@ -1,5 +1,5 @@ #coding=utf-8 -# 执行示例 bundle exec rake public_course:student args=1,2 +# 执行示例 bundle exec rake public_course:student args=149,2903 # args 第一个参数是subject_id,第二个参数是课程course_id desc "同步精品课数据" @@ -13,7 +13,7 @@ namespace :public_course do puts "course_id is #{course_id}" user_ids = Myshixun.find_by_sql("select user_id from myshixuns where shixun_id in (select shixun_id from stage_shixuns - where stage_id in (select id from stages where subject_id=1))").try(:user_id) + where stage_id in (select id from stages where subject_id=#{subject_id}))").try(:user_id) puts user_ids if user_ids.present? user_ids.each do |user_id| From 33e227dac8173af832a71e0fabd226f7e15e6ba1 Mon Sep 17 00:00:00 2001 From: jingquan huang Date: Tue, 13 Aug 2019 18:26:02 +0800 Subject: [PATCH 08/11] rake --- lib/tasks/publick_course.rake | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/tasks/publick_course.rake b/lib/tasks/publick_course.rake index 20a9a5d3a..532e32369 100644 --- a/lib/tasks/publick_course.rake +++ b/lib/tasks/publick_course.rake @@ -12,8 +12,8 @@ namespace :public_course do puts "subject_id is #{subject_id}" puts "course_id is #{course_id}" - user_ids = Myshixun.find_by_sql("select user_id from myshixuns where shixun_id in (select shixun_id from stage_shixuns - where stage_id in (select id from stages where subject_id=#{subject_id}))").try(:user_id) + user_ids = Myshixun.find_by_sql("select distinct(user_id) from myshixuns where shixun_id in (select shixun_id from stage_shixuns + where stage_id in (select id from stages where subject_id=#{subject_id}))").map(&:user_id) puts user_ids if user_ids.present? user_ids.each do |user_id| From 97429b9c2357b7cdf8dfc25b48e1edd070611a4e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 13 Aug 2019 18:27:14 +0800 Subject: [PATCH 09/11] =?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/courses/shixunHomework/ShixunStudentWork.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js b/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js index 0c2e528c5..bb5ff3577 100644 --- a/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js +++ b/public/react/src/modules/courses/shixunHomework/ShixunStudentWork.js @@ -155,6 +155,7 @@ class ShixunStudentWork extends Component { data: response.data, datalist:datas, lunxun:false, + duplicatechecking:false, }); } } @@ -215,6 +216,7 @@ class ShixunStudentWork extends Component { if (response.data.status === undefined || response.data.status === 0) { if(response.data!=undefined){ if(response.data.status!=-2){ + console.log(); let datas=[]; let list=response.data.users_reviews; for(var i=0; i Date: Tue, 13 Aug 2019 18:31:17 +0800 Subject: [PATCH 10/11] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/coursesDetail/CoursesBanner.js | 27 +++++++++---------- 1 file changed, 12 insertions(+), 15 deletions(-) diff --git a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js index dfdc6291a..ed4e58e11 100644 --- a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js +++ b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js @@ -248,9 +248,9 @@ class CoursesBanner extends Component { axios.post(url).then((response) => { if(response!==undefined){ window.location.href = "/courses/" + response.data.new_course_id+"/students"; - }else { - this.modalCancel(); + return } + this.modalCancel(); // window.location.href = "/courses/" + response.data.new_course_id; }).catch(function (error) { @@ -259,19 +259,16 @@ class CoursesBanner extends Component { console.log(error); }); - // axios.interceptors.response.use((response) => { - // if (response != undefined) - // if (response && response.data.status === -1) { - // this.setState({ - // antIcon: false, - // }) - // - // } - // return response; - // }, (error) => { - // //TODO 这里如果样式变了会出现css不加载的情况 - // - // }); + axios.interceptors.response.use((response) => { + if (response != undefined) + if (response && response.data.status === -1) { + this.modalCancel(); + } + return response; + }, (error) => { + //TODO 这里如果样式变了会出现css不加载的情况 + + }); } if(this.state.metype===6){ From c6852dda742d9d0378ded5e660e1511f629f00f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 13 Aug 2019 18:35:02 +0800 Subject: [PATCH 11/11] b --- .../courses/shixunHomework/shixunreport/Shixunechart.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/courses/shixunHomework/shixunreport/Shixunechart.js b/public/react/src/modules/courses/shixunHomework/shixunreport/Shixunechart.js index d19835f3b..2deffd5c5 100644 --- a/public/react/src/modules/courses/shixunHomework/shixunreport/Shixunechart.js +++ b/public/react/src/modules/courses/shixunHomework/shixunreport/Shixunechart.js @@ -370,7 +370,7 @@ class Shixunechart extends Component {
  • {data&&data.username}
  • -
  • {data!==undefined?"无":data.student_id===undefined?"无":data.student_id===null?"无":data.student_id}
  • +
  • {data!==undefined?"--":data.student_id===undefined?"--":data.student_id===null?"--":data.student_id}
  • {data&&data.echart_data===undefined?"":data&&data.echart_data.myself_eff[1]}
  • {data&&data.echart_data===undefined?"":data&&data.echart_data.myself_eff[0]}
  • @@ -396,7 +396,7 @@ class Shixunechart extends Component {
  • {data&&data.username}
  • -
  • {data!==undefined?"无":data.student_id===undefined?"无":data.student_id===null?"无":data.student_id}
  • +
  • {data!==undefined?"--":data.student_id===undefined?"--":data.student_id===null?"--":data.student_id}
  • {data&&data.echart_data===undefined?"":data&&data.echart_data.myself_object[1]}