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 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 { } `} 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"?"新建":"编辑"}

*/}
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} > 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} > 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() {