diff --git a/app/models/course_second_category.rb b/app/models/course_second_category.rb index 125a81cb6..630b74807 100644 --- a/app/models/course_second_category.rb +++ b/app/models/course_second_category.rb @@ -5,7 +5,7 @@ class CourseSecondCategory < ApplicationRecord belongs_to :course_module has_many :homework_commons - validates :name, length: { maximum: 30 } + validates :name, length: { maximum: 60 } def category_type_str category_type == "graduation" && name == "毕设选题" ? "graduation_topics" : ( diff --git a/db/migrate/20190724013024_modify_final_score_for_games.rb b/db/migrate/20190724013024_modify_final_score_for_games.rb new file mode 100644 index 000000000..e926cccd6 --- /dev/null +++ b/db/migrate/20190724013024_modify_final_score_for_games.rb @@ -0,0 +1,15 @@ +class ModifyFinalScoreForGames < ActiveRecord::Migration[5.2] + def change + grades = Grade.where(container_type: "Answer") + grades.each do |grade| + g = Game.find_by_id(grade.container_id) + if g.present? + if g.status == 2 && g.answer_open > 0 && g.final_score <= 0 && g.end_time < grade.created_at + g.update_column(:final_score, g.challenge.score) + elsif g.final_score < 0 + g.update_column(:final_score, 0) + end + end + end + end +end diff --git a/public/react/src/modules/courses/new/CoursesNew.js b/public/react/src/modules/courses/new/CoursesNew.js index c5d0009c1..98b790659 100644 --- a/public/react/src/modules/courses/new/CoursesNew.js +++ b/public/react/src/modules/courses/new/CoursesNew.js @@ -88,11 +88,11 @@ class CoursesNew extends Component { } componentDidUpdate(prevProps){ - if(prevProps.current_user!=this.props.current_user){ - if(this.props.current_user.user_identity==="学生"){ - window.location.href ="/403" - } - } + // if(prevProps.current_user!=this.props.current_user){ + // if(this.props.current_user.user_identity==="学生"){ + // window.location.href ="/403" + // } + // } } onChangeTimepublishs = (date, dateString) => { if(dateString===""){ diff --git a/public/react/src/modules/paths/PathDetail/PathDetailIndex.js b/public/react/src/modules/paths/PathDetail/PathDetailIndex.js index bb410c1ce..7211fde5e 100644 --- a/public/react/src/modules/paths/PathDetail/PathDetailIndex.js +++ b/public/react/src/modules/paths/PathDetail/PathDetailIndex.js @@ -139,7 +139,7 @@ class PathDetailIndex extends Component{ let pathid=this.props.match.params.pathId; let url="/paths/"+pathid+".json"; axios.get(url).then((result)=>{ - if (result.data.status == 407) { + if (result.data.status == 407 || result.data.status == 401) { return; } if(result.data.allow_visit===true){ @@ -164,9 +164,11 @@ class PathDetailIndex extends Component{ let pathid=this.props.match.params.pathId; let url="/paths/"+pathid+".json"; axios.get(url).then((result)=>{ - if (result.data.status == 407) { + // TODO 403 让后台返回status 403 比较好 + if (result.data.status == 407 || result.data.status == 401) { return; } + if(result.data.allow_visit===true){ this.setState({ detailInfoList:result.data, diff --git a/public/react/src/modules/tpm/NewHeader.js b/public/react/src/modules/tpm/NewHeader.js index 830c8b1d4..37fac626d 100644 --- a/public/react/src/modules/tpm/NewHeader.js +++ b/public/react/src/modules/tpm/NewHeader.js @@ -495,6 +495,7 @@ submittojoinclass=(value)=>{ } hideshowSearchOpen=(e)=>{ + debugger let {setevaluatinghides}=this.state; if(setevaluatinghides===true){ this.setState({ @@ -519,6 +520,7 @@ submittojoinclass=(value)=>{ } setevaluatinghides=()=>{ + debugger this.setState( { setevaluatinghides:true @@ -600,6 +602,7 @@ submittojoinclass=(value)=>{ // rolearr:["",""], // console.log("618"); // console.log(user_phone_binded); + console.log(showSearchOpentype) return (