diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 54c07d1c1..5ba0db363 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -451,7 +451,7 @@ class ApplicationController < ActionController::Base cpu_limit = config.cpu_limit.presence || 1 cpu_request = config.lower_cpu_limit.presence || 0.1 memory_limit = config.memory_limit.presence || 1024 - request_limit = config.resource_limit.presence || 10 + request_limit = config.request_limit.presence || 10 resource_limit = config.resource_limit.presence || 10000 container << {:image => mirror.name, :cpuLimit => cpu_limit, diff --git a/app/controllers/exercise_questions_controller.rb b/app/controllers/exercise_questions_controller.rb index 52915a8ba..75ada699d 100644 --- a/app/controllers/exercise_questions_controller.rb +++ b/app/controllers/exercise_questions_controller.rb @@ -348,7 +348,7 @@ class ExerciseQuestionsController < ApplicationController #当试卷已发布时(试卷的总状态),当标准答案修改时,如有已提交的学生,需重新计算分数. - if @exercise.exercise_status == Exercise::PUBLISHED + if @exercise.exercise_status >= Exercise::PUBLISHED ex_users_committed = @exercise.exercise_users.exercise_user_committed if ex_users_committed.size > 0 ex_users_committed.each do |ex_user| diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb index ace9e062e..baf594a42 100644 --- a/app/helpers/exercises_helper.rb +++ b/app/helpers/exercises_helper.rb @@ -403,6 +403,12 @@ module ExercisesHelper end user_answer_content = answer_choice_array.sort standard_answer = q.exercise_standard_answers.pluck(:exercise_choice_id).sort #该问题的标准答案,可能有多个 + + #TODO: 旧版多选题的标准答案是放在一个里面的,新版又做成了一个题有多个标准答案(exercise_choice_id存放的是标准答案的位置..) + if q.question_type == 1 && standard_answer.size == 1 + standard_answer = standard_answer.first.to_s.split("").map(&:to_i) + end + if user_answer_content == standard_answer #答案一致,多选或单选才给分,答案不对不给分 if standard_answer.size > 0 q_score_1 = q.question_score diff --git a/db/migrate/20190820102040_change_exercise_1930_position.rb b/db/migrate/20190820102040_change_exercise_1930_position.rb new file mode 100644 index 000000000..acf99b9e5 --- /dev/null +++ b/db/migrate/20190820102040_change_exercise_1930_position.rb @@ -0,0 +1,29 @@ +class ChangeExercise1930Position < ActiveRecord::Migration[5.2] + def change + exs = Exercise.all.includes(:exercise_questions) + exs.each do |ex| + ex_questions = ex&.exercise_questions&.select(:id,:question_number,:exercise_id)&.order("question_number ASC") #试卷的位置迁移 + if ex_questions.present? + ex_questions.each_with_index do |q,index| + puts index + q_num = index + 1 + if q.question_number.to_i != q_num + q.update_attributes(question_number: q_num) + end + end + end + + ex_q_bank = ex&.exercise_bank&.exercise_bank_questions&.select(:id,:question_number,:exercise_bank_id,:shixun_id)&.order("question_number ASC") #试卷的习题库位置迁移 + if ex_q_bank.present? + ex_q_bank.each_with_index do |q,index| + puts index + q_num_1 = index + 1 + if q.question_number.to_i != q_num_1 + q.update_attributes(question_number: q_num_1) + end + end + end + end + + end +end diff --git a/lib/tasks/excellent_course_exercise.rake b/lib/tasks/excellent_course_exercise.rake index d337fbd73..0d8875806 100644 --- a/lib/tasks/excellent_course_exercise.rake +++ b/lib/tasks/excellent_course_exercise.rake @@ -103,6 +103,13 @@ namespace :excellent_course_exercise do end user_answer_content = answer_choice_array.sort standard_answer = q.exercise_standard_answers.pluck(:exercise_choice_id).sort #该问题的标准答案,可能有多个 + + #TODO: 旧版多选题的标准答案是放在一个里面的,新版又做成了一个题有多个标准答案(exercise_choice_id存放的是标准答案的位置..) + + if q.question_type == 1 && standard_answer.size == 1 + standard_answer = standard_answer.first.to_s.split("").map(&:to_i) + end + if user_answer_content == standard_answer #答案一致,多选或单选才给分,答案不对不给分 if standard_answer.size > 0 q_score_1 = q.question_score diff --git a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js index c53233d79..8947cf718 100644 --- a/public/react/src/modules/courses/coursesDetail/CoursesBanner.js +++ b/public/react/src/modules/courses/coursesDetail/CoursesBanner.js @@ -385,6 +385,12 @@ class CoursesBanner extends Component { window.location.reload(); }; + + setHistoryFun=(url)=>{ + this.props.history.replace(url) + } + + render() { let { Addcoursestypes, coursedata,excellent, modalsType, modalsTopval, loadtype,modalsBottomval,antIcon,is_guide,AccountProfiletype} = this.state; @@ -588,10 +594,10 @@ class CoursesBanner extends Component { `} - + this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/teachers")}> 教师 {coursedata.teacher_count} - + this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/students")}> 学生 {coursedata.student_count} {coursedata.credit===null?"": diff --git a/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js b/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js index 16c71f942..d3b68ac32 100644 --- a/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js +++ b/public/react/src/modules/courses/coursesDetail/CoursesLeftNav.js @@ -880,8 +880,10 @@ class Coursesleftnav extends Component{ return(
-
  • this.showsandians(e,key,item.category_url,1)} className={this.props.mainurl===item.category_url&&key===this.props.indexs?"liactive":"clearfix active"} onMouseLeave={(e)=>this.hidesandian(e,key)} onMouseEnter={(e)=>this.showsandian(e,key)}> - this.showsandians(e,key,item.category_url,1)} className={ item.second_category===undefined?"fl ml20 pd0":item.second_category.length===0?"fl ml20 pd0":this.state.sandiantypes===key?"fl ml20 pd0 ebebeb":"fl ml20 pd0"}> + +
  • this.showsandians(e,key,item.category_url,1)} className={this.props.mainurl===item.category_url&&key===this.props.indexs?"liactive":"clearfix active"} onMouseLeave={(e)=>this.hidesandian(e,key)} onMouseEnter={(e)=>this.showsandian(e,key)}> + + this.showsandians(e,key,item.category_url,1)} className={ item.second_category===undefined?"fl ml20 pd0":item.second_category.length===0?"fl ml20 pd0":this.state.sandiantypes===key?"fl ml20 pd0 ebebeb":"fl ml20 pd0"}> { item.type==="announcement"?: item.type==="online_learning"?: @@ -912,7 +914,8 @@ class Coursesleftnav extends Component{ :""} -
  • + + {/*下拉列表*/} @@ -950,14 +953,15 @@ class Coursesleftnav extends Component{ > {/*"/courses/"+this.props.match.params.coursesId+"/"+item.type+"/"+iem.category_type+"/"+iem.category_id*/} +
  • this.selectnavids(e,key,iem.category_id,item.type+"child",iem.second_category_url,key)} onMouseLeave={(e)=>this.twosandianhide(e,index,item.type)} onMouseEnter={(e)=>this.twosandianshow(e,index,item.type)} key={index} ref={provided.innerRef} {...provided.draggableProps} {...provided.dragHandleProps} - title={iem.category_name.length<10?"":iem.category_name} - > + > + {iem.category_name} {iem.category_count===0?"":iem.category_count} @@ -971,6 +975,7 @@ class Coursesleftnav extends Component{ {provided.placeholder} +
  • @@ -993,31 +998,35 @@ class Coursesleftnav extends Component{ return(
    {/**/} - -
  • this.setnavid(e,key,item.id,item.type,item.category_url)} onMouseEnter={(e)=>this.showsandian(e,key)} - title={item.name.length<7?"":item.name} - > - - { - item.type==="announcement"?: - item.type==="online_learning"?: - item.type==="shixun_homework"?: - item.type==="common_homework"?: - item.type==="group_homework"?: - item.type==="graduation"?: - item.type==="exercise"?: - item.type==="poll"?: - item.type==="attachment"?: - item.type==="board"?: - item.type==="course_group"?:"" - } - - this.selectnavid(e,key,item.id,item.type,item.category_url)}>{item.name} - {item.task_count===0?"":item.task_count} - - -
  • + + +
  • this.setnavid(e,key,item.id,item.type,item.category_url)} onMouseEnter={(e)=>this.showsandian(e,key)} + + > + + + { + item.type==="announcement"?: + item.type==="online_learning"?: + item.type==="shixun_homework"?: + item.type==="common_homework"?: + item.type==="group_homework"?: + item.type==="graduation"?: + item.type==="exercise"?: + item.type==="poll"?: + item.type==="attachment"?: + item.type==="board"?: + item.type==="course_group"?:"" + } + + this.selectnavid(e,key,item.id,item.type,item.category_url)}>{item.name} + {item.task_count===0?"":item.task_count} + + + +
  • + {/*
    */} @@ -1035,8 +1044,9 @@ class Coursesleftnav extends Component{ } } return( - -
  • + +
  • + this.selectnavids(e,key,iem.category_id,item.type+"child",iem.second_category_url,key)} > {/*{iem.category_name}*/} @@ -1044,6 +1054,7 @@ class Coursesleftnav extends Component{ {iem.category_count===0?"":iem.category_count} +
  • ) diff --git a/public/react/src/modules/courses/exercise/question/shixunAnswer.js b/public/react/src/modules/courses/exercise/question/shixunAnswer.js index f1fb09227..d8644f8c4 100644 --- a/public/react/src/modules/courses/exercise/question/shixunAnswer.js +++ b/public/react/src/modules/courses/exercise/question/shixunAnswer.js @@ -276,7 +276,7 @@ class shixunAnswer extends Component{ } { item.operation ? - this.scrollToAnchor(`${questionType.question_id}${index+1}`)}>查看 + this.scrollToAnchor(`${questionType.question_id}${index+1}`)}>查看 : -- } diff --git a/public/react/src/modules/page/main/ChooseEvaluateView.js b/public/react/src/modules/page/main/ChooseEvaluateView.js index 754869521..e9a2b6eed 100644 --- a/public/react/src/modules/page/main/ChooseEvaluateView.js +++ b/public/react/src/modules/page/main/ChooseEvaluateView.js @@ -60,8 +60,8 @@ class ChooseEvaluateView extends Component { : item.result === true ?
      -
    • 正确选项:{item.actual_output}
    • -
    • 你的选项:{item.standard_answer}
    • +
    • 正确选项:{item.standard_answer}
    • +
    • 你的选项:{item.actual_output}
    :