From 1f18b1399bbf64d415ae13c91d356044ee7b5d74 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Thu, 25 Jul 2019 15:20:16 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E9=87=8D=E7=BD=AE=E5=AE=9E=E8=AE=AD?= =?UTF-8?q?=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/myshixuns_controller.rb | 35 +++++++++++++------------ 1 file changed, 18 insertions(+), 17 deletions(-) diff --git a/app/controllers/myshixuns_controller.rb b/app/controllers/myshixuns_controller.rb index 649516a03..cdeca4871 100644 --- a/app/controllers/myshixuns_controller.rb +++ b/app/controllers/myshixuns_controller.rb @@ -20,28 +20,29 @@ class MyshixunsController < ApplicationController unless (current_user.admin? || current_user.id == @myshixun.user_id) tip_exception("403", "") end + begin + ActiveRecord::Base.transaction do + begin + @shixun = Shixun.select(:id, :identifier).find(@myshixun.shixun_id) + @myshixun.destroy - ActiveRecord::Base.transaction do - begin - @shixun = Shixun.select(:id, :identifier).find(@myshixun.shixun_id) - @myshixun.destroy + StudentWork.where(:myshixun_id => @myshixun.id).update_all(:myshixun_id => 0, :work_status => 0) - # 刪除版本庫 - begin - GitService.delete_repository(repo_path: @repo_path) + # 实训在申请发布前,是否玩过实训,如果玩过需要更改记录,防止二次重置 + shixun_mod = ShixunModify.where(:shixun_id => @shixun.id, :myshixun_id => @myshixun.id, :status => 1).take + shixun_mod.update_column(:status, 0) if shixun_mod rescue Exception => e - uid_logger_error("版本库删除异常,详情:#{e.message}") + logger.error("######reset_my_game_failed:#{e.message}") + raise("ActiveRecord::RecordInvalid") end - - StudentWork.where(:myshixun_id => @myshixun.id).update_all(:myshixun_id => 0, :work_status => 0) - - # 实训在申请发布前,是否玩过实训,如果玩过需要更改记录,防止二次重置 - shixun_mod = ShixunModify.where(:shixun_id => @shixun.id, :myshixun_id => @myshixun.id, :status => 1).take - shixun_mod.update_column(:status, 0) if shixun_mod - rescue Exception => e - uid_logger_error("myshixun reset failed #{e}") - raise ActiveRecord::Rollback end + # 删除版本库 + GitService.delete_repository(repo_path: @repo_path) + rescue Exception => e + if e.message != "ActiveRecord::RecordInvalid" + logger.error("######delete_repository_error:#{e.message}") + end + raise ActiveRecord::Rollback end end From b9d48c420a7ac491cc8512565e7b98455fac28c2 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Thu, 25 Jul 2019 15:37:29 +0800 Subject: [PATCH 2/6] =?UTF-8?q?=E9=9D=A2=E5=8C=85=E5=B1=91-=E4=BD=9C?= =?UTF-8?q?=E4=B8=9A?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/courses/busyWork/CommonWorkDetailIndex.js | 7 ++++--- .../react/src/modules/courses/busyWork/CommonWorkPost.js | 4 ++-- public/react/src/modules/courses/busyWork/NewWork.js | 3 ++- .../courses/busyWork/common/WorkDetailPageHeader.js | 4 ++-- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/public/react/src/modules/courses/busyWork/CommonWorkDetailIndex.js b/public/react/src/modules/courses/busyWork/CommonWorkDetailIndex.js index 5960406e3..ff8e3e3a2 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkDetailIndex.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkDetailIndex.js @@ -145,6 +145,7 @@ class CommonWorkDetailIndex extends Component{ , end_immediately, publish_immediately, work_statuses, accessoryVisible } =this.state; + const { current_user } = this.props let courseId=this.props.match.params.coursesId; let category_id= category && category.category_id; @@ -197,15 +198,15 @@ class CommonWorkDetailIndex extends Component{ background: #fff; } `} - + ]}>}
36 ? homework_name : ''}`} diff --git a/public/react/src/modules/courses/busyWork/CommonWorkPost.js b/public/react/src/modules/courses/busyWork/CommonWorkPost.js index 4c5578d2c..f2b92b47d 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkPost.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkPost.js @@ -481,6 +481,7 @@ render(){ course_name, homework_name, memberNumMax, memberNumMin } =this.state; + const { current_user } = this.props let courseId=this.props.match.params.coursesId; let workId=this.props.match.params.workId; @@ -522,7 +523,6 @@ render(){ const moduleName = this.props.getModuleName() const moduleCHName = this.props.getModuleName(true) const isGroup = this.props.isGroup() - const { current_user } = this.props; return( @@ -540,7 +540,7 @@ render(){

- {course_name} + {course_name} > {moduleCHName} > diff --git a/public/react/src/modules/courses/busyWork/NewWork.js b/public/react/src/modules/courses/busyWork/NewWork.js index 3bb77dfb5..2519f95e2 100644 --- a/public/react/src/modules/courses/busyWork/NewWork.js +++ b/public/react/src/modules/courses/busyWork/NewWork.js @@ -313,6 +313,7 @@ class NewWork extends Component{ init_max_num, init_min_num, title_num, course_name, category, has_commit, has_project }=this.state + const { current_user } = this.props const courseId = this.state.course_id || this.props.match.params.coursesId ; const isEdit = this.isEdit; @@ -369,7 +370,7 @@ class NewWork extends Component{ {pageType==="new"?"新建":"编辑"}

*/} Date: Thu, 25 Jul 2019 15:42:00 +0800 Subject: [PATCH 3/6] =?UTF-8?q?=E9=9D=A2=E5=8C=85=E5=B1=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/courses/boards/BoardsNew.js | 3 ++- public/react/src/modules/courses/boards/TopicDetail.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/courses/boards/BoardsNew.js b/public/react/src/modules/courses/boards/BoardsNew.js index 9833e9eb3..8d9db7c3f 100644 --- a/public/react/src/modules/courses/boards/BoardsNew.js +++ b/public/react/src/modules/courses/boards/BoardsNew.js @@ -239,6 +239,7 @@ class BoardsNew extends Component{ render() { let { addGroup, fileList, course_id, title_num } = this.state; const { getFieldDecorator } = this.props.form; + const { current_user } = this.props const formItemLayout = { labelCol: { @@ -299,7 +300,7 @@ class BoardsNew extends Component{ `}
diff --git a/public/react/src/modules/courses/boards/TopicDetail.js b/public/react/src/modules/courses/boards/TopicDetail.js index 6309ac491..7aaecdd16 100644 --- a/public/react/src/modules/courses/boards/TopicDetail.js +++ b/public/react/src/modules/courses/boards/TopicDetail.js @@ -546,7 +546,7 @@ class TopicDetail extends Component { } `} From 4b130f2724780815352c10b13596e88d4ebdc4d9 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Thu, 25 Jul 2019 15:48:46 +0800 Subject: [PATCH 4/6] =?UTF-8?q?=E9=9D=A2=E5=8C=85=E5=B1=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/courses/poll/PollDetailIndex.js | 4 ++-- .../react/src/modules/courses/poll/PollInfo.js | 3 ++- .../react/src/modules/courses/poll/PollNew.js | 17 +++++++++++------ 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/public/react/src/modules/courses/poll/PollDetailIndex.js b/public/react/src/modules/courses/poll/PollDetailIndex.js index 8e3f78d5c..9119b7902 100644 --- a/public/react/src/modules/courses/poll/PollDetailIndex.js +++ b/public/react/src/modules/courses/poll/PollDetailIndex.js @@ -110,7 +110,7 @@ class PollDetailIndex extends Component{ } render(){ let {tab,pollDetail,user_permission}=this.state; - + const { current_user } = this.props; const isAdmin =this.props.isAdmin(); const isStudent = this.props.isStudent(); return( @@ -123,7 +123,7 @@ class PollDetailIndex extends Component{ />

- {this.props.coursedata.name} + {this.props.coursedata.name} > 问卷 > diff --git a/public/react/src/modules/courses/poll/PollInfo.js b/public/react/src/modules/courses/poll/PollInfo.js index fc1d55385..f32d652c2 100644 --- a/public/react/src/modules/courses/poll/PollInfo.js +++ b/public/react/src/modules/courses/poll/PollInfo.js @@ -299,6 +299,7 @@ class PollInfo extends Component{ modalSave, questionPanelFixed }=this.state; + const { current_user } = this.props let isAdmin=this.props.isAdmin(); let isStudent=this.props.isStudent(); return( @@ -314,7 +315,7 @@ class PollInfo extends Component{ >

- {courseName} + {courseName} > 问卷 > diff --git a/public/react/src/modules/courses/poll/PollNew.js b/public/react/src/modules/courses/poll/PollNew.js index 0c4109ceb..cd559b75f 100644 --- a/public/react/src/modules/courses/poll/PollNew.js +++ b/public/react/src/modules/courses/poll/PollNew.js @@ -2320,12 +2320,17 @@ class PollNew extends Component { } gotohome=()=>{ - let courseId=this.props.match.params.coursesId; - if(courseId===undefined){ - this.props.history.push("/courses"); - }else{ - this.props.history.push(this.props.current_user.first_category_url); - } + const { current_user} = this.props + + this.props.history.push(current_user.first_category_url); + + + // let courseId=this.props.match.params.coursesId; + // if(courseId===undefined){ + // this.props.history.push("/courses"); + // }else{ + // this.props.history.push(this.props.current_user.first_category_url); + // } } //试图 render() { From 901ed458c44ef96d9d6307abe57ebb207f1035f8 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Thu, 25 Jul 2019 15:53:09 +0800 Subject: [PATCH 5/6] =?UTF-8?q?=E9=9D=A2=E5=8C=85=E5=B1=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/courses/graduation/topics/GraduateTopicDetail.js | 3 ++- .../src/modules/courses/graduation/topics/GraduateTopicNew.js | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/courses/graduation/topics/GraduateTopicDetail.js b/public/react/src/modules/courses/graduation/topics/GraduateTopicDetail.js index be3ff7a30..c0e8fe185 100644 --- a/public/react/src/modules/courses/graduation/topics/GraduateTopicDetail.js +++ b/public/react/src/modules/courses/graduation/topics/GraduateTopicDetail.js @@ -96,6 +96,7 @@ class GraduateTopicDetail extends Component{ tablePageSize, tab, }=this.state + const { current_user } = this.props let {course_id,graduation_topic_id}=this.props.match.params; const isStudent =this.props.isStudent(); const isAdmin =this.props.isAdmin(); @@ -104,7 +105,7 @@ class GraduateTopicDetail extends Component{

- {tableData && tableData.course_name} + {tableData && tableData.course_name} > {tableData.graduation_name} > diff --git a/public/react/src/modules/courses/graduation/topics/GraduateTopicNew.js b/public/react/src/modules/courses/graduation/topics/GraduateTopicNew.js index d71cec73b..569c76331 100644 --- a/public/react/src/modules/courses/graduation/topics/GraduateTopicNew.js +++ b/public/react/src/modules/courses/graduation/topics/GraduateTopicNew.js @@ -276,6 +276,7 @@ class GraduateTopicNew extends Component{ course_name, left_banner_name } = this.state; + const { current_user } = this.props const { getFieldDecorator } = this.props.form; let{ topicId,coursesId }=this.props.match.params console.log(this.props); @@ -322,7 +323,7 @@ class GraduateTopicNew extends Component{ `}

- {course_name} + {course_name} > {left_banner_name} > From 8656c6037e6548d49bfb209ce1ddb5ad5f49cbb8 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Thu, 25 Jul 2019 15:58:42 +0800 Subject: [PATCH 6/6] =?UTF-8?q?=E9=9D=A2=E5=8C=85=E5=B1=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/courses/exercise/ExerciseNew.js | 3 ++- .../src/modules/courses/exercise/ExerciseReviewAndAnswer.js | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/public/react/src/modules/courses/exercise/ExerciseNew.js b/public/react/src/modules/courses/exercise/ExerciseNew.js index 0e1489c72..fe1b8f565 100644 --- a/public/react/src/modules/courses/exercise/ExerciseNew.js +++ b/public/react/src/modules/courses/exercise/ExerciseNew.js @@ -369,6 +369,7 @@ class ExerciceNew extends Component{ }, }; + const { current_user } = this.props const isAdmin = this.props.isAdmin() const courseId=this.props.match.params.coursesId; const exercise_id = this.props.match.params.Id @@ -407,7 +408,7 @@ class ExerciceNew extends Component{ `}

diff --git a/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js b/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js index eb8143c03..cd3355082 100644 --- a/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js +++ b/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js @@ -509,7 +509,7 @@ class ExerciseReviewAndAnswer extends Component{ }=this.state let isAdmin = this.props.isAdmin(); let isStudent =this.props.isStudent(); - + const { current_user } = this.props console.log(data&&data.exercise.user_name) return(
@@ -537,7 +537,7 @@ class ExerciseReviewAndAnswer extends Component{ />

- {courseName} + {courseName} > {data && data.left_banner_name} >