From 6035f984bad86eab0483aad19f02a17005627c17 Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Thu, 22 Aug 2019 17:39:20 +0800 Subject: [PATCH 01/30] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E7=9A=84=E5=88=86?= =?UTF-8?q?=E6=95=B0=E8=BF=81=E7=A7=BB=E6=96=87=E4=BB=B6=E7=9A=84=E4=BF=AE?= =?UTF-8?q?=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...20190822022306_add_exercise_user_update.rb | 38 ++++++++++++++----- 1 file changed, 28 insertions(+), 10 deletions(-) diff --git a/db/migrate/20190822022306_add_exercise_user_update.rb b/db/migrate/20190822022306_add_exercise_user_update.rb index f45e6a8ee..8bf668934 100644 --- a/db/migrate/20190822022306_add_exercise_user_update.rb +++ b/db/migrate/20190822022306_add_exercise_user_update.rb @@ -2,19 +2,37 @@ class AddExerciseUserUpdate < ActiveRecord::Migration[5.2] include ExercisesHelper def change #2019,8,22添加 - exs = Exercise.all.is_exercise_published.where("publish_time > ?",(Time.now - 2.months)).includes(:exercise_questions,:exercise_users) + two_months = Time.now - 2.months + exs = Exercise.all.is_exercise_published.where("publish_time > ?",two_months).includes(:exercise_questions,:exercise_users) exs.each do |ex| - ex_users = ex.exercise_users.exercise_user_committed.where("end_at is not null and end_at > ?",(Time.now - 2.months)) - if ex_users.present? - ex_users.each do |ex_user| - calculate_score = calculate_student_score(ex,ex_user.user)[:total_score] - subjective_score = ex_user.subjective_score - total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score - total_score = calculate_score + total_score_subjective_score - ex_user.update_attributes(score:total_score,objective_score:calculate_score) - puts ex_user.id + if ex.exercise_questions.where("created_at < ?",Time.now - 1.month).pluck(:question_type).include?(1) #含有多选题,且是1个月前创建的才更新 + ex_users = ex.exercise_users.exercise_user_committed.where("end_at is not null and end_at > ?",two_months) + if ex_users.exists? + ex_users.each do |ex_user| + calculate_score = calculate_student_score(ex,ex_user.user)[:total_score] + subjective_score = ex_user.subjective_score + total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score + total_score = calculate_score + total_score_subjective_score + ex_user.update_attributes(score:total_score,objective_score:calculate_score) + puts ex_user.id + end end end end + + #1936的试卷成绩有问题。 + # #https://www.educoder.net/courses/2935/exercises/1936/users/pizfnr5ts + ex_special = Exercise.find_by_id(1936) + ex_special_users = ex_special.exercise_users.exercise_user_committed.where("end_at is not null and end_at > ?",two_months) + if ex_special.present? && ex_special_users.exists? + ex_special_users.each do |ex_user| + calculate_score = calculate_student_score(ex_special,ex_user.user)[:total_score] + subjective_score = ex_user.subjective_score + total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score + total_score = calculate_score + total_score_subjective_score + ex_user.update_attributes(score:total_score,objective_score:calculate_score) + puts ex_user.id + end + end end end From 646bf9e0b5f3a9b12561dfce6ca3507ba8344f9e Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Fri, 23 Aug 2019 09:39:09 +0800 Subject: [PATCH 02/30] qiayi --- ...20190822022306_add_exercise_user_update.rb | 72 +++++++++---------- ...13551_re_calculate_exercise_users_socre.rb | 38 ++++++++++ 2 files changed, 74 insertions(+), 36 deletions(-) create mode 100644 db/migrate/20190823013551_re_calculate_exercise_users_socre.rb diff --git a/db/migrate/20190822022306_add_exercise_user_update.rb b/db/migrate/20190822022306_add_exercise_user_update.rb index 8bf668934..05881c78b 100644 --- a/db/migrate/20190822022306_add_exercise_user_update.rb +++ b/db/migrate/20190822022306_add_exercise_user_update.rb @@ -1,38 +1,38 @@ class AddExerciseUserUpdate < ActiveRecord::Migration[5.2] - include ExercisesHelper - def change - #2019,8,22添加 - two_months = Time.now - 2.months - exs = Exercise.all.is_exercise_published.where("publish_time > ?",two_months).includes(:exercise_questions,:exercise_users) - exs.each do |ex| - if ex.exercise_questions.where("created_at < ?",Time.now - 1.month).pluck(:question_type).include?(1) #含有多选题,且是1个月前创建的才更新 - ex_users = ex.exercise_users.exercise_user_committed.where("end_at is not null and end_at > ?",two_months) - if ex_users.exists? - ex_users.each do |ex_user| - calculate_score = calculate_student_score(ex,ex_user.user)[:total_score] - subjective_score = ex_user.subjective_score - total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score - total_score = calculate_score + total_score_subjective_score - ex_user.update_attributes(score:total_score,objective_score:calculate_score) - puts ex_user.id - end - end - end - end - - #1936的试卷成绩有问题。 - # #https://www.educoder.net/courses/2935/exercises/1936/users/pizfnr5ts - ex_special = Exercise.find_by_id(1936) - ex_special_users = ex_special.exercise_users.exercise_user_committed.where("end_at is not null and end_at > ?",two_months) - if ex_special.present? && ex_special_users.exists? - ex_special_users.each do |ex_user| - calculate_score = calculate_student_score(ex_special,ex_user.user)[:total_score] - subjective_score = ex_user.subjective_score - total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score - total_score = calculate_score + total_score_subjective_score - ex_user.update_attributes(score:total_score,objective_score:calculate_score) - puts ex_user.id - end - end - end + # include ExercisesHelper + # def change + # #2019,8,22添加 + # two_months = Time.now - 2.months + # exs = Exercise.all.is_exercise_published.where("publish_time > ?",two_months).includes(:exercise_questions,:exercise_users) + # exs.each do |ex| + # if ex.exercise_questions.where("created_at < ?",Time.now - 1.month).pluck(:question_type).include?(1) #含有多选题,且是1个月前创建的才更新 + # ex_users = ex.exercise_users.exercise_user_committed.where("end_at is not null and end_at > ?",two_months) + # if ex_users.exists? + # ex_users.each do |ex_user| + # calculate_score = calculate_student_score(ex,ex_user.user)[:total_score] + # subjective_score = ex_user.subjective_score + # total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score + # total_score = calculate_score + total_score_subjective_score + # ex_user.update_attributes(score:total_score,objective_score:calculate_score) + # puts ex_user.id + # end + # end + # end + # end + # + # #1936的试卷成绩有问题。 + # # #https://www.educoder.net/courses/2935/exercises/1936/users/pizfnr5ts + # ex_special = Exercise.find_by_id(1936) + # ex_special_users = ex_special.exercise_users.exercise_user_committed.where("end_at is not null and end_at > ?",two_months) + # if ex_special.present? && ex_special_users.exists? + # ex_special_users.each do |ex_user| + # calculate_score = calculate_student_score(ex_special,ex_user.user)[:total_score] + # subjective_score = ex_user.subjective_score + # total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score + # total_score = calculate_score + total_score_subjective_score + # ex_user.update_attributes(score:total_score,objective_score:calculate_score) + # puts ex_user.id + # end + # end + # end end diff --git a/db/migrate/20190823013551_re_calculate_exercise_users_socre.rb b/db/migrate/20190823013551_re_calculate_exercise_users_socre.rb new file mode 100644 index 000000000..cd6c67c76 --- /dev/null +++ b/db/migrate/20190823013551_re_calculate_exercise_users_socre.rb @@ -0,0 +1,38 @@ +class ReCalculateExerciseUsersSocre < ActiveRecord::Migration[5.2] + include ExercisesHelper + def change + #2019,8,22添加 + two_months = Time.now - 2.months + exs = Exercise.all.is_exercise_published.where("publish_time > ?",two_months).includes(:exercise_questions,:exercise_users) + exs.each do |ex| + if ex.exercise_questions.where("created_at < ?",Time.now - 1.month).pluck(:question_type).include?(1) #含有多选题,且是1个月前创建的才更新 + ex_users = ex.exercise_users.exercise_user_committed.where("end_at is not null and end_at > ?",two_months) + if ex_users.exists? + ex_users.each do |ex_user| + calculate_score = calculate_student_score(ex,ex_user.user)[:total_score] + subjective_score = ex_user.subjective_score + total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score + total_score = calculate_score + total_score_subjective_score + ex_user.update_attributes(score:total_score,objective_score:calculate_score) + puts ex_user.id + end + end + end + end + + #1936的试卷成绩有问题。 + # #https://www.educoder.net/courses/2935/exercises/1936/users/pizfnr5ts + ex_special = Exercise.find_by_id(1936) + ex_special_users = ex_special.exercise_users.exercise_user_committed.where("end_at is not null and end_at > ?",two_months) + if ex_special.present? && ex_special_users.exists? + ex_special_users.each do |ex_user| + calculate_score = calculate_student_score(ex_special,ex_user.user)[:total_score] + subjective_score = ex_user.subjective_score + total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score + total_score = calculate_score + total_score_subjective_score + ex_user.update_attributes(score:total_score,objective_score:calculate_score) + puts ex_user.id + end + end + end +end From fd316974ede4062e1496193e7314cc0a517e9778 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 23 Aug 2019 09:39:10 +0800 Subject: [PATCH 03/30] =?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/TraineetraininginformationModal.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/courses/shixunHomework/TraineetraininginformationModal.js b/public/react/src/modules/courses/shixunHomework/TraineetraininginformationModal.js index 9b86483df..0baf2cabe 100644 --- a/public/react/src/modules/courses/shixunHomework/TraineetraininginformationModal.js +++ b/public/react/src/modules/courses/shixunHomework/TraineetraininginformationModal.js @@ -236,11 +236,11 @@ class TraineetraininginformationModal extends Component {
  • {this.props.viewtrainingdata === undefined ? "" :this.props.viewtrainingdata.username} 通关:{this.props.viewtrainingdata === undefined ? "" :this.props.viewtrainingdata.complete_count}/{this.props.viewtrainingdata === undefined ? "" :this.props.viewtrainingdata.challenges_count}
  • -
  • 完成效率:{this.props.viewtrainingdata === undefined ? "" :this.props.viewtrainingdata.efficiency}
  • + {this.props.viewtrainingdata === undefined ? "" :this.props.viewtrainingdata.efficiency === undefined ? "" :this.props.viewtrainingdata.efficiency === null ? "" :this.props.viewtrainingdata.efficiency === "" ? "" :
  • 完成效率:{this.props.viewtrainingdata.efficiency}
  • }
  • 通关时间: {this.props.viewtrainingdata === undefined ? "":moment(this.props.viewtrainingdata.passed_time).format('YYYY-MM-DD HH:mm')==="Invalid date"?"--":moment(this.props.viewtrainingdata.passed_time).format('YYYY-MM-DD HH:mm')}
  • -
  • 课堂最高完成效率: {this.props.viewtrainingdata === undefined ? "" :this.props.viewtrainingdata.max_efficiency}
  • + {this.props.viewtrainingdata === undefined ? "" :this.props.viewtrainingdata.max_efficiency === undefined ? "" :this.props.viewtrainingdata.max_efficiency === null ? "" :this.props.viewtrainingdata.max_efficiency === "" ? "" :
  • 课堂最高完成效率: {this.props.viewtrainingdata.max_efficiency}
  • }
  • 总耗时: {this.props.viewtrainingdata === undefined ? "" :this.props.viewtrainingdata.total_spend_time}
  • From dae6ee08e015235a8ee41d3af60b099beb7d8a23 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Fri, 23 Aug 2019 10:07:31 +0800 Subject: [PATCH 04/30] =?UTF-8?q?=E8=BF=94=E5=9B=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../src/modules/courses/boards/BoardsNew.js | 10 ++++++++-- .../courses/busyWork/CommonWorkDetailIndex.js | 16 ++++++++-------- .../src/modules/courses/exercise/ExerciseNew.js | 3 ++- 3 files changed, 18 insertions(+), 11 deletions(-) diff --git a/public/react/src/modules/courses/boards/BoardsNew.js b/public/react/src/modules/courses/boards/BoardsNew.js index 43be980ed..f5b11519d 100644 --- a/public/react/src/modules/courses/boards/BoardsNew.js +++ b/public/react/src/modules/courses/boards/BoardsNew.js @@ -236,6 +236,12 @@ class BoardsNew extends Component{ title_num: 60 - parseInt(e.target.value.length) }) } + goBack = () => { + // this.props.history.goBack() + const courseId=this.props.match.params.coursesId; + const boardId = this.props.match.params.boardId + this.props.toListPage(courseId, boardId) + } render() { let { addGroup, fileList, course_id, title_num } = this.state; const { getFieldDecorator } = this.props.form; @@ -309,8 +315,8 @@ class BoardsNew extends Component{

    {this.isEdit ? "编辑" : "新建"}帖子 this.props.history.goBack()}> - {/*返回*/} + onClick={this.goBack}> + 返回

    {/* notRequired */} diff --git a/public/react/src/modules/courses/busyWork/CommonWorkDetailIndex.js b/public/react/src/modules/courses/busyWork/CommonWorkDetailIndex.js index 65cda33a9..bd1cafaa1 100644 --- a/public/react/src/modules/courses/busyWork/CommonWorkDetailIndex.js +++ b/public/react/src/modules/courses/busyWork/CommonWorkDetailIndex.js @@ -75,15 +75,15 @@ class CommonWorkDetailIndex extends Component{ }) } goback = () => { - // let workId=this.props.match.params.workId; + let workId=this.props.match.params.workId; // - // if ( window.location.pathname.indexOf('appraise') == -1) { - // let category_id= this.state.category.category_id; - // this.props.toListPage(this.props.match.params, category_id) - // } else { - // this.props.toWorkListPage(this.props.match.params, workId) - // } - this.props.history.goBack() + if ( window.location.pathname.indexOf('appraise') == -1) { + let category_id= this.state.category.category_id; + this.props.toListPage(this.props.match.params, category_id) + } else { + this.props.toWorkListPage(this.props.match.params, workId) + } + // this.props.history.goBack() } // 补交附件 diff --git a/public/react/src/modules/courses/exercise/ExerciseNew.js b/public/react/src/modules/courses/exercise/ExerciseNew.js index b790086b8..69c655f2a 100644 --- a/public/react/src/modules/courses/exercise/ExerciseNew.js +++ b/public/react/src/modules/courses/exercise/ExerciseNew.js @@ -418,7 +418,8 @@ class ExerciceNew extends Component{

    {this.isEdit ? "编辑" : "新建"}试卷 this.props.history.length == 1 ? this.props.history.push(`/courses/${courseId}/exercises/${left_banner_id}`): this.props.history.goBack()}> + // () => this.props.history.length == 1 ? : this.props.history.goBack() + onClick={() => this.props.history.push(`/courses/${courseId}/exercises/${left_banner_id}`)}> 返回

    From 0326690f16c90d4c32413b4507aba8b2482d789a Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 23 Aug 2019 10:23:02 +0800 Subject: [PATCH 05/30] =?UTF-8?q?=E7=BF=BB=E8=BD=AC=E8=AF=BE=E5=A0=82?= =?UTF-8?q?=E7=9A=84=E8=AE=A8=E8=AE=BA=E5=8C=BA=E7=9A=84=E6=95=B0=E7=9B=AE?= =?UTF-8?q?=E4=B8=8D=E5=87=86=E7=A1=AE=E4=BA=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- config/initializers/aliyun_vod_init.rb | 1 + .../20190823015610_add_message_count_for_boards.rb | 9 +++++++++ 2 files changed, 10 insertions(+) create mode 100644 db/migrate/20190823015610_add_message_count_for_boards.rb diff --git a/config/initializers/aliyun_vod_init.rb b/config/initializers/aliyun_vod_init.rb index 78893df95..47b1dc6a3 100644 --- a/config/initializers/aliyun_vod_init.rb +++ b/config/initializers/aliyun_vod_init.rb @@ -10,6 +10,7 @@ rescue => ex puts %Q{\033[33m [warning] aliyun vod config or configuration.yml missing, please add it or execute 'cp config/configuration.yml.example config/configuration.yml' \033[0m} + aliyun_vod_config = {} end AliyunVod.access_key_id = aliyun_vod_config['access_key_id'] diff --git a/db/migrate/20190823015610_add_message_count_for_boards.rb b/db/migrate/20190823015610_add_message_count_for_boards.rb new file mode 100644 index 000000000..6f121cfc0 --- /dev/null +++ b/db/migrate/20190823015610_add_message_count_for_boards.rb @@ -0,0 +1,9 @@ +class AddMessageCountForBoards < ActiveRecord::Migration[5.2] + def change + boards = Board.where(:parent_id => 0) + Board.reset_column_information + boards.find_each do |board| + Board.reset_counters board.id, :messages + end + end +end From 01c4fe882ab21032aafdfa24b1f01d2447affc1f Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Fri, 23 Aug 2019 10:23:50 +0800 Subject: [PATCH 06/30] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E7=9A=84=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E7=BB=93=E6=9E=9C=E7=9A=84=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/exercises_helper.rb | 65 ++++++++++++++++----------------- 1 file changed, 32 insertions(+), 33 deletions(-) diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb index 2e327c86f..f25fd76ca 100644 --- a/app/helpers/exercises_helper.rb +++ b/app/helpers/exercises_helper.rb @@ -83,12 +83,13 @@ module ExercisesHelper @ex_sub_array = @ex_sub_array.sort_by {|k| k[:q_position]} end - #试卷的统计结果页面计算各题的 + #试卷的统计结果页面计算各题的。选择题和判断题原来是按:已回答了本题的人数来计算的。现需要按已提交试卷的人数来计算。2019-8-23 def exercise_commit_result(questions,user_ids) question_infos = [] - # percent = 0.0 + percent = 0.0 + commit_user_ids = user_ids.size questions.includes(:exercise_choices).each do |ex| - ex_total_score = user_ids.count * ex&.question_score.to_f #该试卷的已回答的总分 + ex_total_score = commit_user_ids * ex&.question_score.to_f #该试卷的已回答的总分 # ex_answers = ex.exercise_answers if ex.question_type != Exercise::PRACTICAL ques_title = ex.question_title @@ -104,41 +105,38 @@ module ExercisesHelper effictive_users_count = effictive_users.size #有效回答数,可能有重复的用户id,这里仅统计是否回答这个问题的全部人数 # - # if ex.question_type > Exercise::COMPLETION #当为主观题和实训题时, - # ex_answered_scores = effictive_users.score_reviewed.pluck(:score).sum #该问题的全部得分 - # percent = (ex_total_score == 0.0 ? 0.0 : (ex_answered_scores / ex_total_score.to_f).round(3) * 100) #正确率 - # end - - #全部题型按已提交学生的分数来计算 - ex_answered_scores = effictive_users.score_reviewed.pluck(:score).sum #该问题的全部得分 - percent = (ex_total_score == 0.0 ? 0.0 : (ex_answered_scores / ex_total_score.to_f).round(3) * 100) #正确率 + if ex.question_type > Exercise::COMPLETION #当为主观题和实训题时, + ex_answered_scores = effictive_users.score_reviewed.pluck(:score).sum #该问题的全部得分 + percent = (ex_total_score == 0.0 ? 0.0 : (ex_answered_scores / ex_total_score.to_f).round(3) * 100) #正确率 + end question_answer_infos = [] if ex.question_type <= Exercise::JUDGMENT #选择题和判断题 ex_choices = ex.exercise_choices standard_answer = ex.exercise_standard_answers.pluck(:exercise_choice_id).sort #标准答案的位置 # right_users_count = 0 - #该问题的正确率 - # if ex.question_type == Exercise::MULTIPLE #多选题 - # right_user_ids = user_ids - # standard_answer.each do |choice_position| - # standard_answer_choice_id = ex_choices.select{|ec| ec.choice_position == choice_position}.first&.id - # right_user_ids = right_user_ids & effictive_users.select{|answer| answer.exercise_choice_id == standard_answer_choice_id}.pluck(:user_id) - # end - # right_users_count = right_user_ids.size - # # user_ids.each do |user_id| - # # ex_choice_ids = effictive_users.map{|e| e.exercise_choice_id if e.user_id == user_id}.reject(&:blank?).uniq - # # answer_choice_array = ex_choices.map{|a| a.choice_position if ex_choice_ids.include?(a.id)}.reject(&:blank?).uniq - # # if answer_choice_array.sort == standard_answer - # # right_users_count += 1 - # # end - # # end - # else #单选题和判断题 - # standard_answer_choice_id = ex_choices.select{|ec| ec.choice_position == standard_answer.first}.first&.id - # right_users_count = effictive_users.select{|answer| answer.exercise_choice_id == standard_answer_choice_id}.size - # end - - # percent = effictive_users_count > 0 ? (right_users_count / effictive_users_count.to_f).round(3)*100 : 0.0 + # 该问题的正确率 + if ex.question_type == Exercise::MULTIPLE #多选题 + right_user_ids = user_ids + standard_answer.each do |choice_position| + standard_answer_choice_id = ex_choices.select{|ec| ec.choice_position == choice_position}.first&.id + right_user_ids = right_user_ids & effictive_users.select{|answer| answer.exercise_choice_id == standard_answer_choice_id}.pluck(:user_id) + end + right_users_count = right_user_ids.size + + # user_ids.each do |user_id| + # ex_choice_ids = effictive_users.map{|e| e.exercise_choice_id if e.user_id == user_id}.reject(&:blank?).uniq + # answer_choice_array = ex_choices.map{|a| a.choice_position if ex_choice_ids.include?(a.id)}.reject(&:blank?).uniq + # if answer_choice_array.sort == standard_answer + # right_users_count += 1 + # end + # end + else #单选题和判断题 + standard_answer_choice_id = ex_choices.select{|ec| ec.choice_position == standard_answer.first}.first&.id + right_users_count = effictive_users.select{|answer| answer.exercise_choice_id == standard_answer_choice_id}.size + end + + percent = commit_user_ids > 0 ? (right_users_count / commit_user_ids.to_f).round(3)*100 : 0.0 #每个选项的正确率 ex_choices.each do |c| @@ -184,7 +182,8 @@ module ExercisesHelper all_user_count += user_count standard_answer_count += 1 end - # percent = effictive_users_count > 0 ? (all_user_count / effictive_users_count.to_f).round(3)*100 : 0.0 + percent = commit_user_ids > 0 ? (all_user_count / commit_user_ids.to_f).round(3)*100 : 0.0 + user_wrong_count = (effictive_users_count - all_user_count ) if effictive_users_count > 0 && user_wrong_count >= 0 From 1c436719dde7d5c2feda70f9c6f85bde89875dfe Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Fri, 23 Aug 2019 10:33:41 +0800 Subject: [PATCH 07/30] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E7=9A=84=E7=BB=9F?= =?UTF-8?q?=E8=AE=A1=E7=BB=93=E6=9E=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/exercises_helper.rb | 8 -------- 1 file changed, 8 deletions(-) diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb index f25fd76ca..7caed7fae 100644 --- a/app/helpers/exercises_helper.rb +++ b/app/helpers/exercises_helper.rb @@ -123,14 +123,6 @@ module ExercisesHelper right_user_ids = right_user_ids & effictive_users.select{|answer| answer.exercise_choice_id == standard_answer_choice_id}.pluck(:user_id) end right_users_count = right_user_ids.size - - # user_ids.each do |user_id| - # ex_choice_ids = effictive_users.map{|e| e.exercise_choice_id if e.user_id == user_id}.reject(&:blank?).uniq - # answer_choice_array = ex_choices.map{|a| a.choice_position if ex_choice_ids.include?(a.id)}.reject(&:blank?).uniq - # if answer_choice_array.sort == standard_answer - # right_users_count += 1 - # end - # end else #单选题和判断题 standard_answer_choice_id = ex_choices.select{|ec| ec.choice_position == standard_answer.first}.first&.id right_users_count = effictive_users.select{|answer| answer.exercise_choice_id == standard_answer_choice_id}.size From 4b73d7e39d238500faf1db62689a8368669c864c Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Fri, 23 Aug 2019 10:38:05 +0800 Subject: [PATCH 08/30] =?UTF-8?q?=E6=B7=BB=E5=8A=A01936=E8=AF=95=E5=8D=B7?= =?UTF-8?q?=E7=9A=84=E8=BF=81=E7=A7=BB=E6=96=87=E4=BB=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...190823023738_change_exericse_1936_scores.rb | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 db/migrate/20190823023738_change_exericse_1936_scores.rb diff --git a/db/migrate/20190823023738_change_exericse_1936_scores.rb b/db/migrate/20190823023738_change_exericse_1936_scores.rb new file mode 100644 index 000000000..202909276 --- /dev/null +++ b/db/migrate/20190823023738_change_exericse_1936_scores.rb @@ -0,0 +1,18 @@ +class ChangeExericse1936Scores < ActiveRecord::Migration[5.2] + def change + #1936的试卷成绩有问题。 + # #https://www.educoder.net/courses/2935/exercises/1936/users/pizfnr5ts + ex_special = Exercise.find_by_id(1936) + ex_special_users = ex_special.exercise_users.exercise_user_committed.where("end_at is not null and end_at > ?",Time.now - 2.months) + if ex_special.present? && ex_special_users.exists? + ex_special_users.each do |ex_user| + calculate_score = calculate_student_score(ex_special,ex_user.user)[:total_score] + subjective_score = ex_user.subjective_score + total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score + total_score = calculate_score + total_score_subjective_score + ex_user.update_attributes(score:total_score,objective_score:calculate_score) + puts ex_user.id + end + end + end +end From f3e9d5e75ecb6db0c8371b6e4f75e88365abfbd5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 23 Aug 2019 10:39:01 +0800 Subject: [PATCH 09/30] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../react/src/modules/courses/css/members.css | 152 +++++++++--------- .../TraineetraininginformationModal.js | 4 +- .../shixunHomework/Trainingjobsetting.js | 13 +- 3 files changed, 94 insertions(+), 75 deletions(-) diff --git a/public/react/src/modules/courses/css/members.css b/public/react/src/modules/courses/css/members.css index c04a0e57f..ff6f0d99d 100644 --- a/public/react/src/modules/courses/css/members.css +++ b/public/react/src/modules/courses/css/members.css @@ -1,72 +1,80 @@ -.studentList_operation_ul{ - color: #999; - font-size: 12px; - float: right; - margin-top: 2px; -} -.studentList_operation_ul li{ - float: left; - padding:0px 20px; - position: relative; - cursor: pointer; - flex: 0 0 26px; - line-height: 26px; -} -.studentList_operation_ul li.li_line:after{ - position: absolute; - content: ''; - width: 1px; - height: 12px; - background-color: #EDEDED; - right: 0px; - top:6px; -} -.studentList_operation_ul li:last-child{ - padding-right: 0px; -} -.studentList_operation_ul li:last-child:after{ - width: 0px; -} - -/* 基础的下拉列表、列如排序等 */ -.drop_down_normal li{ - padding: 0px 20px; - height: 34px; - line-height: 34px; - min-width: 96px; - color: #333; - font-size: 14px; - cursor: pointer; - width: 100%; -} - -.stu_table table{ - line-height: 1.2; -} -.stu_table .classesName{ - display: block; - max-width: 428px; -} -.stu_table .ant-table-thead > tr > th{ - padding:21px 16px; - border-bottom: none; -} -.stu_table .ant-table-tbody tr:last-child td{ - border-bottom: none; -} -.stu_table table .ant-table-tbody > tr:hover:not(.ant-table-expanded-row) > td{ - background-color: #fff; -} - -.stu_head{ - padding-bottom: 15px; -} -.ant-modal-body{ - padding:30px 40px; -} -.color-dark-21{ - color: #212121; -} -.tabletd { - background-color:#E6F7FF; -} +.studentList_operation_ul{ + color: #999; + font-size: 12px; + float: right; + margin-top: 2px; +} +.studentList_operation_ul li{ + float: left; + padding:0px 20px; + position: relative; + cursor: pointer; + flex: 0 0 26px; + line-height: 26px; +} +.studentList_operation_ul li.li_line:after{ + position: absolute; + content: ''; + width: 1px; + height: 12px; + background-color: #EDEDED; + right: 0px; + top:6px; +} +.studentList_operation_ul li:last-child{ + padding-right: 0px; +} +.studentList_operation_ul li:last-child:after{ + width: 0px; +} + +/* 基础的下拉列表、列如排序等 */ +.drop_down_normal li{ + padding: 0px 20px; + height: 34px; + line-height: 34px; + min-width: 96px; + color: #333; + font-size: 14px; + cursor: pointer; + width: 100%; +} + +.stu_table table{ + line-height: 1.2; +} +.stu_table .classesName{ + display: block; + max-width: 428px; +} +.stu_table .ant-table-thead > tr > th{ + padding:21px 16px; + border-bottom: none; +} +.stu_table .ant-table-tbody tr:last-child td{ + border-bottom: none; +} +.stu_table table .ant-table-tbody > tr:hover:not(.ant-table-expanded-row) > td{ + background-color: #fff; +} + +.stu_head{ + padding-bottom: 15px; +} +.ant-modal-body{ + padding:30px 40px; +} +.color-dark-21{ + color: #212121; +} +.tabletd { + background-color:#E6F7FF; +} + +.yslminheigth{ + min-height: 20px; +} + +.yslminheigths{ + min-height: 21px; +} \ No newline at end of file diff --git a/public/react/src/modules/courses/shixunHomework/TraineetraininginformationModal.js b/public/react/src/modules/courses/shixunHomework/TraineetraininginformationModal.js index 0baf2cabe..7babe1e6b 100644 --- a/public/react/src/modules/courses/shixunHomework/TraineetraininginformationModal.js +++ b/public/react/src/modules/courses/shixunHomework/TraineetraininginformationModal.js @@ -236,11 +236,11 @@ class TraineetraininginformationModal extends Component {
  • {this.props.viewtrainingdata === undefined ? "" :this.props.viewtrainingdata.username} 通关:{this.props.viewtrainingdata === undefined ? "" :this.props.viewtrainingdata.complete_count}/{this.props.viewtrainingdata === undefined ? "" :this.props.viewtrainingdata.challenges_count}
  • - {this.props.viewtrainingdata === undefined ? "" :this.props.viewtrainingdata.efficiency === undefined ? "" :this.props.viewtrainingdata.efficiency === null ? "" :this.props.viewtrainingdata.efficiency === "" ? "" :
  • 完成效率:{this.props.viewtrainingdata.efficiency}
  • } + {this.props.viewtrainingdata === undefined ?
  • :this.props.viewtrainingdata.efficiency === undefined ?
  • :this.props.viewtrainingdata.efficiency === null ?
  • :this.props.viewtrainingdata.efficiency === "null" ?
  • :this.props.viewtrainingdata.efficiency === "" ?
  • :
  • 完成效率:{this.props.viewtrainingdata.efficiency}
  • }
  • 通关时间: {this.props.viewtrainingdata === undefined ? "":moment(this.props.viewtrainingdata.passed_time).format('YYYY-MM-DD HH:mm')==="Invalid date"?"--":moment(this.props.viewtrainingdata.passed_time).format('YYYY-MM-DD HH:mm')}
  • - {this.props.viewtrainingdata === undefined ? "" :this.props.viewtrainingdata.max_efficiency === undefined ? "" :this.props.viewtrainingdata.max_efficiency === null ? "" :this.props.viewtrainingdata.max_efficiency === "" ? "" :
  • 课堂最高完成效率: {this.props.viewtrainingdata.max_efficiency}
  • } + {this.props.viewtrainingdata === undefined ?
  • :this.props.viewtrainingdata.max_efficiency === undefined ?
  • :this.props.viewtrainingdata.max_efficiency === null ?
  • :this.props.viewtrainingdata.max_efficiency === "null" ?
  • : this.props.viewtrainingdata.max_efficiency === "" ?
  • :
  • 课堂最高完成效率: {this.props.viewtrainingdata.max_efficiency}
  • }
  • 总耗时: {this.props.viewtrainingdata === undefined ? "" :this.props.viewtrainingdata.total_spend_time}
  • diff --git a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js index 9cb2bd973..bd90db42f 100644 --- a/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js +++ b/public/react/src/modules/courses/shixunHomework/Trainingjobsetting.js @@ -322,9 +322,14 @@ class Trainingjobsetting extends Component { }; challenge_scoredata.push(datas[i].challenge_score); array.push(object) + console.log("datas[i].challenge_score"); + console.log(i); + console.log(datas[i].challenge_score); } } + console.log("提交的数据"+"pustdate"); + console.log("提交的数据"+"pustdate"); if (this.state.jobsettingsdata.data.unified_setting === true) { if (this.state.unifiedsetting === true) { @@ -560,14 +565,20 @@ class Trainingjobsetting extends Component { if(challenge_scoredata.length>0){ var len = 0; for (var k = 0; k < challenge_scoredata.length; k++) { - len = len + challenge_scoredata[k]; + len = len + parseFloat(challenge_scoredata[k]); + console.log(len); + console.log(challenge_scoredata[k]); + console.log(len); + } var max = latedeductiontwos + len; if (max > 100) { + console.log("max>100"); this.props.showNotification(`总分值+效率占比分之和要等于100,现在分值为` + max); return; } if(max<100){ + console.log("max<100"); this.props.showNotification(`总分值+效率占比分之和要等于100,现在分值为` + max); return; } From cffec8f4f0e4eb301a9c38c0fc09e9fbebb0b3d2 Mon Sep 17 00:00:00 2001 From: hjm <63528605@qq.com> Date: Fri, 23 Aug 2019 10:51:17 +0800 Subject: [PATCH 10/30] =?UTF-8?q?=E6=95=B0=E5=AD=97?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../react/src/modules/courses/boards/BoardsNew.js | 13 +++++++------ .../react/src/modules/courses/busyWork/NewWork.js | 9 +++++---- .../src/modules/courses/exercise/ExerciseNew.js | 6 ++++-- 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/public/react/src/modules/courses/boards/BoardsNew.js b/public/react/src/modules/courses/boards/BoardsNew.js index f5b11519d..d2b218f3d 100644 --- a/public/react/src/modules/courses/boards/BoardsNew.js +++ b/public/react/src/modules/courses/boards/BoardsNew.js @@ -17,6 +17,7 @@ import {getUploadActionUrl, bytesToSize, uploadNameSizeSeperator, appendFileSize const confirm = Modal.confirm; const $ = window.$ const { Option } = Select; +const MAX_TITLE_LENGTH = 60 // https://lanhuapp.com/web/#/item/project/board/detail?pid=a3bcd4b1-99ce-4e43-8ead-5b8b0a410807&project_id=a3bcd4b1-99ce-4e43-8ead-5b8b0a410807&image_id=71072679-b925-4824-aceb-4649535e3652 class BoardsNew extends Component{ constructor(props){ @@ -27,7 +28,7 @@ class BoardsNew extends Component{ this.state = { fileList: [], boards: [], - title_num: 60 + title_num: 0 } } addSuccess = () => { @@ -95,7 +96,7 @@ class BoardsNew extends Component{ } }) - this.setState({ fileList: _fileList, board_name: data.board_name, title_num: 60 - parseInt(data.subject.length) }) + this.setState({ fileList: _fileList, board_name: data.board_name, title_num: parseInt(data.subject.length) }) } } }) @@ -233,7 +234,7 @@ class BoardsNew extends Component{ changeTitle=(e)=>{ console.log(e.target.value.length); this.setState({ - title_num: 60 - parseInt(e.target.value.length) + title_num: parseInt(e.target.value.length) }) } goBack = () => { @@ -345,11 +346,11 @@ class BoardsNew extends Component{ rules: [{ required: true, message: '请输入标题', }, { - max: 60, message: '最大限制为60个字符', + max: MAX_TITLE_LENGTH, message: `最大限制为${MAX_TITLE_LENGTH}个字符`, }], })( - + )} diff --git a/public/react/src/modules/courses/busyWork/NewWork.js b/public/react/src/modules/courses/busyWork/NewWork.js index 410d12a3f..83e792d68 100644 --- a/public/react/src/modules/courses/busyWork/NewWork.js +++ b/public/react/src/modules/courses/busyWork/NewWork.js @@ -9,6 +9,7 @@ import CBreadcrumb from '../common/CBreadcrumb' const confirm = Modal.confirm; const $ = window.$ +const MAX_TITLE_LENGTH = 60; class NewWork extends Component{ constructor(props){ super(props); @@ -17,7 +18,7 @@ class NewWork extends Component{ this.state={ title_value:"", - title_num:60, + title_num: 0, contentFileList: [], answerFileList: [], workLoaded: false, @@ -91,7 +92,7 @@ class NewWork extends Component{ // course_id: data.course_id, // course_name: data.course_name, // category: data.category, - title_num: 60 - parseInt(data.name.length), + title_num: parseInt(data.name.length), workLoaded: true, init_min_num: data.min_num, init_max_num: data.max_num, @@ -125,7 +126,7 @@ class NewWork extends Component{ changeTitle=(e)=>{ console.log(e.target.value.length); this.setState({ - title_num: 60 - parseInt(e.target.value.length) + title_num: parseInt(e.target.value.length) }) } handleSubmit = () => { @@ -398,7 +399,7 @@ class NewWork extends Component{ required: true, message: '请输入标题' }], })( - + )} - this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/teachers")}> + this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/teachers")} className={"pointer"}> 教师 {coursedata.teacher_count} - this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/students")}> + this.setHistoryFun("/courses/"+this.props.match.params.coursesId+"/students")} className={"pointer"}> 学生 {coursedata.student_count} {coursedata.credit===null?"": diff --git a/public/stylesheets/educoder/edu-all.css b/public/stylesheets/educoder/edu-all.css index 4f6dadcf9..a76c8dc19 100644 --- a/public/stylesheets/educoder/edu-all.css +++ b/public/stylesheets/educoder/edu-all.css @@ -3743,4 +3743,12 @@ a.singlepublishtwo{ .square-main p{ margin-bottom: 0em; +} + +.bestChoose{ + cursor: pointer; +} + +.pointer{ + cursor: pointer; } \ No newline at end of file From ab06fa5296466331fb02643d0433d8114cf299eb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=98=8E?= <775174143@qq.com> Date: Fri, 23 Aug 2019 13:16:25 +0800 Subject: [PATCH 17/30] . --- public/react/src/modules/paths/ShixunPathSearch.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/public/react/src/modules/paths/ShixunPathSearch.js b/public/react/src/modules/paths/ShixunPathSearch.js index 649611a4c..c0060a528 100644 --- a/public/react/src/modules/paths/ShixunPathSearch.js +++ b/public/react/src/modules/paths/ShixunPathSearch.js @@ -139,8 +139,8 @@ class ShixunPathSearch extends Component{
    {/* this.changeStatus("publish_time")}>全部*/} {/* this.changeStatus("mine")}>我的*/} - this.changeStatus("updated_at")}>最新 - this.changeStatus("myshixun_count")}>最热 + this.changeStatus("updated_at")}>最新 + this.changeStatus("myshixun_count")}>最热 {/*
    */} {/*/!* Date: Fri, 23 Aug 2019 13:52:05 +0800 Subject: [PATCH 18/30] =?UTF-8?q?=E8=B0=83=E6=95=B4=E5=AD=97=E4=BD=93?= =?UTF-8?q?=E5=A4=A7=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../react/src/modules/paths/PathDetail/PathDetailIndex.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/public/react/src/modules/paths/PathDetail/PathDetailIndex.js b/public/react/src/modules/paths/PathDetail/PathDetailIndex.js index 6383b7d60..f1b0a3bbb 100644 --- a/public/react/src/modules/paths/PathDetail/PathDetailIndex.js +++ b/public/react/src/modules/paths/PathDetail/PathDetailIndex.js @@ -393,7 +393,7 @@ class PathDetailIndex extends Component{
    {detailInfoList === undefined ? "" :detailInfoList.description===null?"": -
    +
    }
    @@ -420,8 +420,8 @@ class PathDetailIndex extends Component{

    {detailInfoList === undefined ? "" :detailInfoList.learning_notes===null?"": - - } +
    + }
    {tags === undefined ? "" :tags === null ? "": From 77496f28581c6d823e7c91dba6621c24c004e85a Mon Sep 17 00:00:00 2001 From: SylorHuang Date: Fri, 23 Aug 2019 13:56:55 +0800 Subject: [PATCH 19/30] fixubg --- app/helpers/exercises_helper.rb | 75 ++++++++++--------- ...13551_re_calculate_exercise_users_socre.rb | 38 ---------- 2 files changed, 40 insertions(+), 73 deletions(-) delete mode 100644 db/migrate/20190823013551_re_calculate_exercise_users_socre.rb diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb index 7caed7fae..0b18ff6f8 100644 --- a/app/helpers/exercises_helper.rb +++ b/app/helpers/exercises_helper.rb @@ -461,45 +461,50 @@ module ExercisesHelper end elsif q.question_type == 5 #实训题时,主观题这里不评分 q.exercise_shixun_challenges&.each do |exercise_cha| - game = Game.user_games(user.id,exercise_cha.challenge_id)&.first #当前用户的关卡 - if game.present? - exercise_cha_score = 0.0 - answer_status = 0 - # if game.status == 2 && game.final_score >= 0 - if game.final_score > 0 - exercise_cha_score = game.real_score(exercise_cha.question_score) - # exercise_cha_score = exercise_cha.question_score #每一关卡的得分 - answer_status = 1 - end - ex_shixun_answer_content = answers_content&.where(exercise_shixun_challenge_id: exercise_cha.id) - code = nil - if exercise_cha.challenge&.path.present? - cha_path = challenge_path(exercise_cha.challenge&.path) - game_challenge = game.game_codes.search_challenge_path(cha_path)&.first - if game_challenge.present? - game_code = game_challenge - code = game_code.try(:new_code) + user_shixun_score = exercise_cha&.exercise_shixun_answers&.where(user_id:user.id,exercise_question_id:q.id) + if user_shixun_score.present? + score5 += user_shixun_score&.first.score + else + game = Game.user_games(user.id,exercise_cha.challenge_id)&.first #当前用户的关卡 + if game.present? + exercise_cha_score = 0.0 + answer_status = 0 + # if game.status == 2 && game.final_score >= 0 + if game.final_score > 0 + exercise_cha_score = game.real_score(exercise_cha.question_score) + # exercise_cha_score = exercise_cha.question_score #每一关卡的得分 + answer_status = 1 + end + ex_shixun_answer_content = answers_content&.where(exercise_shixun_challenge_id: exercise_cha.id) + code = nil + if exercise_cha.challenge&.path.present? + cha_path = challenge_path(exercise_cha.challenge&.path) + game_challenge = game.game_codes.search_challenge_path(cha_path)&.first + if game_challenge.present? + game_code = game_challenge + code = game_code.try(:new_code) + else + code = git_fle_content(game.myshixun.repo_path,cha_path) + end + end + if ex_shixun_answer_content.blank? #把关卡的答案存入试卷的实训里 + ### Todo 实训题的_shixun_details里的代码是不是直接从这里取出就可以了?涉及到code的多个版本库的修改 + sx_option = { + :exercise_question_id => q.id, + :exercise_shixun_challenge_id => exercise_cha.id, + :user_id => user.id, + :score => exercise_cha_score.round(1), + :answer_text => code, + :status => answer_status + } + ExerciseShixunAnswer.create(sx_option) else - code = git_fle_content(game.myshixun.repo_path,cha_path) + ex_shixun_answer_content.first.update_attributes(score:exercise_cha_score.round(1),answer_text:code) end - end - if ex_shixun_answer_content.blank? #把关卡的答案存入试卷的实训里 - ### Todo 实训题的_shixun_details里的代码是不是直接从这里取出就可以了?涉及到code的多个版本库的修改 - sx_option = { - :exercise_question_id => q.id, - :exercise_shixun_challenge_id => exercise_cha.id, - :user_id => user.id, - :score => exercise_cha_score.round(1), - :answer_text => code, - :status => answer_status - } - ExerciseShixunAnswer.create(sx_option) + score5 += exercise_cha_score else - ex_shixun_answer_content.first.update_attributes(score:exercise_cha_score.round(1),answer_text:code) + score5 += 0.0 end - score5 += exercise_cha_score - else - score5 += 0.0 end end end diff --git a/db/migrate/20190823013551_re_calculate_exercise_users_socre.rb b/db/migrate/20190823013551_re_calculate_exercise_users_socre.rb deleted file mode 100644 index c36a3df3f..000000000 --- a/db/migrate/20190823013551_re_calculate_exercise_users_socre.rb +++ /dev/null @@ -1,38 +0,0 @@ -class ReCalculateExerciseUsersSocre < ActiveRecord::Migration[5.2] - include ExercisesHelper - def change - #2019,8,22添加 - two_months = Time.now - 2.months - exs = Exercise.all.is_exercise_published.where("publish_time > ?",two_months).includes(:exercise_questions,:exercise_users) - exs.each do |ex| - if ex.exercise_questions.where("created_at < ?",Time.now - 1.month).pluck(:question_type).include?(1) #含有多选题,且是1个月前创建的才更新 - ex_users = ex.exercise_users.exercise_user_committed.where("end_at is not null and end_at > ?",two_months) - if ex_users.exists? - ex_users.each do |ex_user| - calculate_score = calculate_student_score(ex,ex_user.user)[:total_score] - subjective_score = ex_user.subjective_score - total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score - total_score = calculate_score + total_score_subjective_score - ex_user.update_attributes(score:total_score,objective_score:calculate_score) - puts ex_user.id - end - end - end - end - - # #1936的试卷成绩有问题。 - # # #https://www.educoder.net/courses/2935/exercises/1936/users/pizfnr5ts - # ex_special = Exercise.find_by_id(1936) - # ex_special_users = ex_special.exercise_users.exercise_user_committed.where("end_at is not null and end_at > ?",two_months) - # if ex_special.present? && ex_special_users.exists? - # ex_special_users.each do |ex_user| - # calculate_score = calculate_student_score(ex_special,ex_user.user)[:total_score] - # subjective_score = ex_user.subjective_score - # total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score - # total_score = calculate_score + total_score_subjective_score - # ex_user.update_attributes(score:total_score,objective_score:calculate_score) - # puts ex_user.id - # end - # end - end -end From 4a104921baf5ee6c8580519ce77a8159106bbf6b Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 23 Aug 2019 14:13:12 +0800 Subject: [PATCH 20/30] =?UTF-8?q?=E5=88=9B=E5=BB=BA=E5=AD=A6=E7=94=9F?= =?UTF-8?q?=E7=9A=84=E4=BD=9C=E5=93=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/jobs/create_student_work_job.rb | 21 +++++++++++++++++++++ app/services/homeworks_service.rb | 3 ++- spec/jobs/create_student_work_job_spec.rb | 5 +++++ 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 app/jobs/create_student_work_job.rb create mode 100644 spec/jobs/create_student_work_job_spec.rb diff --git a/app/jobs/create_student_work_job.rb b/app/jobs/create_student_work_job.rb new file mode 100644 index 000000000..1fd9a9b00 --- /dev/null +++ b/app/jobs/create_student_work_job.rb @@ -0,0 +1,21 @@ +class CreateStudentWorkJob < ApplicationJob + queue_as :default + + def perform(homework_id) + homework = HomeworkCommon.find_by(id: homework_id) + course = homework&.course + return if homework.blank? || course.blank? + + attrs = %i[homework_common_id user_id created_at updated_at] + + same_attrs = {homework_common_id: homework.id} + + StudentWork.bulk_insert(*attrs) do |worker| + student_ids = course.students.pluck(:user_id) + + student_ids.each do |user_id| + worker.add same_attrs.merge(user_id: user_id) + end + end + end +end diff --git a/app/services/homeworks_service.rb b/app/services/homeworks_service.rb index 78be3b8f9..64aec92c6 100644 --- a/app/services/homeworks_service.rb +++ b/app/services/homeworks_service.rb @@ -15,7 +15,8 @@ class HomeworksService homework_detail_manual.save! if homework_detail_manual HomeworkCommonsShixun.create!(homework_common_id: homework.id, shixun_id: shixun.id) HomeworksService.new.create_shixun_homework_cha_setting(homework, shixun) - HomeworksService.new.create_works_list(homework, course) + CreateStudentWorkJob.perform_later(homework.id) + # HomeworksService.new.create_works_list(homework, course) end homework end diff --git a/spec/jobs/create_student_work_job_spec.rb b/spec/jobs/create_student_work_job_spec.rb new file mode 100644 index 000000000..401160f80 --- /dev/null +++ b/spec/jobs/create_student_work_job_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe CreateStudentWorkJob, type: :job do + pending "add some examples to (or delete) #{__FILE__}" +end From 358cb63d5a8f28b880e4f490d4e13f1d74516362 Mon Sep 17 00:00:00 2001 From: caicai8 <1149225589@qq.com> Date: Fri, 23 Aug 2019 14:49:47 +0800 Subject: [PATCH 21/30] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E8=AF=84=E9=98=85-?= =?UTF-8?q?=E8=B7=B3=E8=BD=AC=E5=88=B0TPI=E5=9C=B0=E5=9D=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../react/src/modules/courses/exercise/question/shixunAnswer.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/exercise/question/shixunAnswer.js b/public/react/src/modules/courses/exercise/question/shixunAnswer.js index d8644f8c4..64e4214fa 100644 --- a/public/react/src/modules/courses/exercise/question/shixunAnswer.js +++ b/public/react/src/modules/courses/exercise/question/shixunAnswer.js @@ -316,7 +316,7 @@ class shixunAnswer extends Component{ 第{item[0].position}关 - + {item[0].name} From 7d49c25d4b6682618a64076cc9329ddf04945b82 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 23 Aug 2019 14:55:08 +0800 Subject: [PATCH 22/30] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/application_controller.rb | 2 +- .../homework_commons_controller.rb | 6 +++-- app/controllers/subjects_controller.rb | 8 ------- .../homework_commons/subjects.json.jbuilder | 8 +++---- app/views/subjects/show.json.jbuilder | 22 ------------------- 5 files changed, 9 insertions(+), 37 deletions(-) diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 656dba0ae..233d94c8f 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -240,7 +240,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 1 end diff --git a/app/controllers/homework_commons_controller.rb b/app/controllers/homework_commons_controller.rb index eb3576f24..b95d0d2b4 100644 --- a/app/controllers/homework_commons_controller.rb +++ b/app/controllers/homework_commons_controller.rb @@ -992,13 +992,15 @@ class HomeworkCommonsController < ApplicationController @total_count = @subjects.size if reorder != "myshixun_count" - @subjects = @subjects.page(page).per(limit).includes(:shixuns, user: [user_extension: :school]) + # @subjects = @subjects.page(page).per(limit).includes(:shixuns, user: [user_extension: :school]) + @subjects = @subjects.page(page).per(limit).includes(:shixuns) else @subjects = @subjects[offset, limit] unless @subjects.blank? subject_ids = @subjects.pluck(:id) order_ids = subject_ids.size > 0 ? subject_ids.join(',') : -1 - @subjects = Subject.where(id: subject_ids).order("field(id,#{order_ids})").includes(:shixuns, user: [user_extension: :school]) + # @subjects = Subject.where(id: subject_ids).order("field(id,#{order_ids})").includes(:shixuns, user: [user_extension: :school]) + @subjects = Subject.where(id: subject_ids).order("field(id,#{order_ids})").includes(:shixuns) end end end diff --git a/app/controllers/subjects_controller.rb b/app/controllers/subjects_controller.rb index 6c5481787..a62707536 100644 --- a/app/controllers/subjects_controller.rb +++ b/app/controllers/subjects_controller.rb @@ -87,14 +87,6 @@ class SubjectsController < ApplicationController @courses = @subject.courses if @subject.excellent @members = @subject.subject_members.includes(:user) - shixuns = @subject.shixuns.published.pluck(:id) - challenge_ids = Challenge.where(shixun_id: shixuns).pluck(:id) - # 实训路径中的所有实训标签 - @tags = ChallengeTag.where(challenge_id: challenge_ids).pluck(:name).uniq - # 用户获取的实训标签 - # @user_tags = @subject.shixuns.map(&:user_tags_name).flatten.uniq - @user_tags = user_shixun_tags challenge_ids, @user.id - @my_subject_progress = @subject.my_subject_progress # 访问数变更 @subject.increment!(:visits) end diff --git a/app/views/homework_commons/subjects.json.jbuilder b/app/views/homework_commons/subjects.json.jbuilder index 257fcc9d5..f24ff2097 100644 --- a/app/views/homework_commons/subjects.json.jbuilder +++ b/app/views/homework_commons/subjects.json.jbuilder @@ -6,12 +6,12 @@ end json.subject_list @subjects do |subject| json.subject_id subject.id json.subject_name subject.name - json.challenge_tags subject.shixun_tags + # json.challenge_tags subject.shixun_tags json.shixun_count subject.shixuns.unhidden.size json.myshixun_count subject.shixuns.pluck(:myshixuns_count).sum - json.creator subject.user&.full_name - json.creator_login subject.user&.login - json.school subject.user&.school_name + # json.creator subject.user&.full_name + # json.creator_login subject.user&.login + # json.school subject.user&.school_name end json.subjects_count @total_count \ No newline at end of file diff --git a/app/views/subjects/show.json.jbuilder b/app/views/subjects/show.json.jbuilder index ec76b5a2d..53e76a96f 100644 --- a/app/views/subjects/show.json.jbuilder +++ b/app/views/subjects/show.json.jbuilder @@ -23,26 +23,4 @@ if @subject.excellent json.course_identity @user.course_identity(course) json.course_status subject_course_status course end -end - - -json.members @members do |member| - json.partial! 'subject_member', locals: { user: member.user } - json.role member.role -end - -# 技能标签 -json.tags @tags do |tag| - unless tag.blank? - json.tag_name tag - json.status @user_tags.include?(tag) - end -end - -# 我的进展 -json.progress do - json.my_score @subject.my_subject_score - json.all_score @subject.all_score - json.learned @subject.my_subject_progress - json.time @subject.my_consume_time end \ No newline at end of file From b4612d70e0a5fe33e0efd52af48cd69106c3bcd7 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 23 Aug 2019 15:01:43 +0800 Subject: [PATCH 23/30] =?UTF-8?q?=E6=96=B0=E8=AF=BE=E5=AF=BC=E8=AF=AD?= =?UTF-8?q?=E7=9A=84=E5=9B=9E=E5=A4=8D=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/old_message_detail.rb | 2 ++ ...63747_modify_contents_for_old_message_details.rb | 13 +++++++++++++ spec/models/old_message_detail_spec.rb | 5 +++++ 3 files changed, 20 insertions(+) create mode 100644 app/models/old_message_detail.rb create mode 100644 db/migrate/20190823063747_modify_contents_for_old_message_details.rb create mode 100644 spec/models/old_message_detail_spec.rb diff --git a/app/models/old_message_detail.rb b/app/models/old_message_detail.rb new file mode 100644 index 000000000..5c1b94f51 --- /dev/null +++ b/app/models/old_message_detail.rb @@ -0,0 +1,2 @@ +class OldMessageDetail < ApplicationRecord +end diff --git a/db/migrate/20190823063747_modify_contents_for_old_message_details.rb b/db/migrate/20190823063747_modify_contents_for_old_message_details.rb new file mode 100644 index 000000000..fc163515e --- /dev/null +++ b/db/migrate/20190823063747_modify_contents_for_old_message_details.rb @@ -0,0 +1,13 @@ +class ModifyContentsForOldMessageDetails < ActiveRecord::Migration[5.2] + def change + messages = Message.where(subject: "新课导语").where.not(parent_id: 0).where("created_on < '2019-08-23 02:00:00'") + messages.find_each do |m| + m.update_column(:is_md, true) + message_detail = m.message_detail + if message_detail + content = OldMessageDetail.find_by(message_detail.id)&.content + message_detail.update_column(:content, content) + end + end + end +end diff --git a/spec/models/old_message_detail_spec.rb b/spec/models/old_message_detail_spec.rb new file mode 100644 index 000000000..0aadef6ee --- /dev/null +++ b/spec/models/old_message_detail_spec.rb @@ -0,0 +1,5 @@ +require 'rails_helper' + +RSpec.describe OldMessageDetail, type: :model do + pending "add some examples to (or delete) #{__FILE__}" +end From 3f171406dfe4e32183d330fc9abce4192d952d28 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 23 Aug 2019 15:06:36 +0800 Subject: [PATCH 24/30] =?UTF-8?q?=E9=87=91=E8=AF=BE=E7=9A=84=E5=AD=A6?= =?UTF-8?q?=E4=B9=A0=E4=BA=BA=E6=95=B0=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/subject.rb | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/models/subject.rb b/app/models/subject.rb index 836976418..3ec030f80 100644 --- a/app/models/subject.rb +++ b/app/models/subject.rb @@ -39,9 +39,10 @@ class Subject < ApplicationRecord courses.pluck(:end_date).max end - # 挑战过路径的成员数 + # 挑战过路径的成员数(金课统计去重后的报名人数) def member_count - shixuns.pluck(:myshixuns_count).sum + excellent && CourseMember.where(role: 4, course_id: courses.pluck(:id)).pluck(:user_id).uniq.length > 0 ? + CourseMember.where(role: 4, course_id: courses.pluck(:id)).pluck(:user_id).uniq.length : shixuns.pluck(:myshixuns_count).sum end def all_score From d1264ae7465e1776a18b1e85ab45cd083d5f1889 Mon Sep 17 00:00:00 2001 From: daiao <358551898@qq.com> Date: Fri, 23 Aug 2019 15:07:45 +0800 Subject: [PATCH 25/30] =?UTF-8?q?=E8=BF=81=E7=A7=BB=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20190823063747_modify_contents_for_old_message_details.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/migrate/20190823063747_modify_contents_for_old_message_details.rb b/db/migrate/20190823063747_modify_contents_for_old_message_details.rb index fc163515e..4607881fe 100644 --- a/db/migrate/20190823063747_modify_contents_for_old_message_details.rb +++ b/db/migrate/20190823063747_modify_contents_for_old_message_details.rb @@ -5,7 +5,7 @@ class ModifyContentsForOldMessageDetails < ActiveRecord::Migration[5.2] m.update_column(:is_md, true) message_detail = m.message_detail if message_detail - content = OldMessageDetail.find_by(message_detail.id)&.content + content = OldMessageDetail.find_by_id(message_detail.id)&.content message_detail.update_column(:content, content) end end From 2a395a901d7990ec78555d8a4284004a2e60f410 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 23 Aug 2019 15:09:16 +0800 Subject: [PATCH 26/30] tiaozheng --- app/models/subject.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/models/subject.rb b/app/models/subject.rb index 3ec030f80..3c94ad870 100644 --- a/app/models/subject.rb +++ b/app/models/subject.rb @@ -41,7 +41,7 @@ class Subject < ApplicationRecord # 挑战过路径的成员数(金课统计去重后的报名人数) def member_count - excellent && CourseMember.where(role: 4, course_id: courses.pluck(:id)).pluck(:user_id).uniq.length > 0 ? + excellent && CourseMember.where(role: 4, course_id: courses.pluck(:id)).pluck(:user_id).uniq.length > shixuns.pluck(:myshixuns_count).sum ? CourseMember.where(role: 4, course_id: courses.pluck(:id)).pluck(:user_id).uniq.length : shixuns.pluck(:myshixuns_count).sum end From dd2e6f5565ab55f390eb8b1c6258757770602538 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 23 Aug 2019 15:10:36 +0800 Subject: [PATCH 27/30] =?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/coursesPublic/Addcourses.js | 14 ++-- .../react/src/modules/courses/poll/PollNew.js | 83 ++++++++++++++++--- .../courses/shixunHomework/shixunHomework.js | 4 +- 3 files changed, 82 insertions(+), 19 deletions(-) diff --git a/public/react/src/modules/courses/coursesPublic/Addcourses.js b/public/react/src/modules/courses/coursesPublic/Addcourses.js index a4599bffb..f03608c8b 100644 --- a/public/react/src/modules/courses/coursesPublic/Addcourses.js +++ b/public/react/src/modules/courses/coursesPublic/Addcourses.js @@ -48,8 +48,8 @@ class Addcourses extends Component{ } componentDidUpdate = (prevProps) => { - console.log(prevProps); - console.log(this.props); + // console.log(prevProps); + // console.log(this.props); if(prevProps.occupation!==this.props.occupation){ this.setState({ Addcoursestype:false, @@ -222,8 +222,8 @@ class Addcourses extends Component{ student:student } ).then((response) => { - console.log("submittojoinclass"); - console.log(response); + // console.log("submittojoinclass"); + // console.log(response); if(response === undefined){ this.setState({ // Addcoursestype:false, @@ -302,7 +302,7 @@ class Addcourses extends Component{ isSpin:false }); }).catch((error) => { - console.log(error) + console.log(error); this.setState({ Addcoursestype:false, isSpin:false @@ -326,8 +326,8 @@ class Addcourses extends Component{ Addcoursestypes }=this.state; const antIcon = ; - console.log("Addcourses"); - console.log(Addcoursestypes) + // console.log("Addcourses"); + // console.log(Addcoursestypes) return(
    { + console.log("调用了changeTopicName"); let num = 60 - parseInt(e.target.value.length); this.setState({ addonAfter: num < 0 ? 0 : num @@ -124,8 +127,35 @@ class PollNew extends Component { console.log("问卷返回"); console.log(this.props); + try { + if(this.props.current_user!==undefined){ + this.setState({ + first_category_url :this.props.current_user.first_category_url, + }); + console.log("======================="); + console.log(this.props.current_user.first_category_url); + } + }catch (e) { + console.log("12312312312") + console.log(e); + } + }; + componentDidUpdate = (prevProps) => { + // console.log("componentDidUpdate"); + // console.log(prevProps); + // console.log(this.props); + if(prevProps.current_user!=this.props.current_user){ + if(this.props.current_user!==undefined){ + // console.log(this.props.current_user.login); + // console.log(prevProps.current_user.login); + this.setState({ + first_category_url :this.props.current_user.first_category_url, + }) + } + } } + //获取权限 // getPollInfo(){ // // console.log(this.props.match); @@ -144,12 +174,12 @@ class PollNew extends Component { // } //初始化请求网络 Initializatio_data = () => { - // console.log("Initializatio_data 582") + console.log("Initializatio_data 582") //课堂id let coursesId = this.props.match.params.coursesId; //时间id let pollid = this.props.match.params.pollid; - // console.log(pollid); + console.log(pollid); // let coursesId = 557; if (pollid === undefined) { // console.log("没有问卷新建问卷~~~") @@ -215,6 +245,19 @@ class PollNew extends Component { polls_nametest: result.data.poll.polls_name, polls_descriptiontest: result.data.poll.polls_description, }); + + if(result.data){ + if(result.data.poll){ + if(result.data.poll.polls_name){ + let num = 60 - parseInt(result.data.poll.polls_name.length); + this.setState({ + addonAfter: num < 0 ? 0 : num + }) + } + } + + } + this.setState({ projects: result.data, pollid: pollid, @@ -229,6 +272,7 @@ class PollNew extends Component { polls_nametest: result.data.poll.polls_name, polls_descriptiontest: result.data.poll.polls_description, questionnair: true, + left_banner_id:result.data.left_banner_id }) // console.log(this.state.polls_nametest) // console.log(this.state.polls_descriptiontest) @@ -2338,10 +2382,13 @@ class PollNew extends Component { } gotohome=()=>{ // const { current_user} = this.props + if(this.state.first_category_url){ + window.location.href=this.state.first_category_url; + }else{ + this.props.history.goBack(); + } - // this.props.history.push(current_user && current_user.first_category_url); // - this.props.history.goBack() // let courseId=this.props.match.params.coursesId; // if(courseId===undefined){ // this.props.history.push("/courses"); @@ -2360,6 +2407,7 @@ class PollNew extends Component { readOnlys, newoption, cancellation, + left_banner_id } = this.state //获取老师权限 // console.log("[`${maps[polls_status && polls_status]}`]]"); @@ -2404,16 +2452,30 @@ class PollNew extends Component {

    this.gotohome()}>{this.props.coursedata.name} > - 问卷 + { + this.props.match.params.news === "new"? + 问卷 + : + 问卷 + } + > {this.props.match.params.news === undefined ? "新建" : this.props.match.params.news === "new" ? "新建" : "编辑"}

    {this.props.match.params.news === undefined ? "新建问卷" : this.props.match.params.news === "new" ? "新建问卷" : "编辑问卷"}

    - this.gotohome()} - className=" fr font-16">返回 + { + this.props.match.params.news === "new" ? + 返回 + : + 返回 + } +
    {/*
    */} @@ -2461,12 +2523,13 @@ class PollNew extends Component { }
    - + {/*addonAfter={String(addonAfter)}*/} diff --git a/public/react/src/modules/courses/shixunHomework/shixunHomework.js b/public/react/src/modules/courses/shixunHomework/shixunHomework.js index 71fd8744e..74d142129 100644 --- a/public/react/src/modules/courses/shixunHomework/shixunHomework.js +++ b/public/react/src/modules/courses/shixunHomework/shixunHomework.js @@ -1019,8 +1019,8 @@ class ShixunHomework extends Component{

    - {/*{datas&&datas.category_name===undefined||datas&&datas.category_name===null?datas&&datas.main_category_name:datas&&datas.category_name+" 作业列表"}*/} - 实训作业 + {datas&&datas.category_name===undefined||datas&&datas.category_name===null?datas&&datas.main_category_name:datas&&datas.category_name+" 作业列表"} + {/* 实训作业*/}

  • {this.props.isAdmin()===true?datas&&datas.category_name===undefined||datas&&datas.category_name===null? From bbe1c4a5eb24e00b65c1dbbc9ec47e1c400f4bc3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Fri, 23 Aug 2019 15:26:39 +0800 Subject: [PATCH 28/30] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/react/src/modules/courses/gradinforms/Eduinforms.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/public/react/src/modules/courses/gradinforms/Eduinforms.js b/public/react/src/modules/courses/gradinforms/Eduinforms.js index aef54ab13..777f04bc6 100644 --- a/public/react/src/modules/courses/gradinforms/Eduinforms.js +++ b/public/react/src/modules/courses/gradinforms/Eduinforms.js @@ -149,7 +149,7 @@ class Eduinforms extends Component{
  • :
    -
    +
    From 6c19c8d213fd85992941c0899506763066ba9dfc Mon Sep 17 00:00:00 2001 From: caicai8 <1149225589@qq.com> Date: Fri, 23 Aug 2019 15:27:12 +0800 Subject: [PATCH 29/30] =?UTF-8?q?=E9=97=AE=E5=8D=B7=E6=A8=A1=E5=9D=97?= =?UTF-8?q?=E7=9A=84=E8=BF=94=E5=9B=9E=E6=8C=89=E9=92=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/courses/exercise/ExerciseReviewAndAnswer.js | 8 +++++++- .../src/modules/courses/exercise/question/shixunAnswer.js | 2 +- public/react/src/modules/courses/poll/PollDetailIndex.js | 2 +- public/react/src/modules/courses/poll/PollInfo.js | 2 +- public/react/src/modules/courses/poll/PollNew.js | 6 ++++-- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js b/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js index 91ca19e7d..cdbc7218b 100644 --- a/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js +++ b/public/react/src/modules/courses/exercise/ExerciseReviewAndAnswer.js @@ -479,6 +479,12 @@ class ExerciseReviewAndAnswer extends Component{ }) } + // 返回 + returnBtn = () =>{ + let coursesId=this.props.match.params.coursesId; + let eId=this.props.match.params.Id; + this.props.history.push(`/courses/${coursesId}/exercises/${eId}/student_exercise_list?tab=0`) + } render(){ let coursesId=this.props.match.params.coursesId; @@ -561,7 +567,7 @@ class ExerciseReviewAndAnswer extends Component{ { (isAdmin || ( isStudent && exercise && user_exercise_status == 1)) ? - this.props.history.goBack()}>返回 + 返回 : time && time != 0 ?
    diff --git a/public/react/src/modules/courses/exercise/question/shixunAnswer.js b/public/react/src/modules/courses/exercise/question/shixunAnswer.js index 64e4214fa..cdffe08b8 100644 --- a/public/react/src/modules/courses/exercise/question/shixunAnswer.js +++ b/public/react/src/modules/courses/exercise/question/shixunAnswer.js @@ -316,7 +316,7 @@ class shixunAnswer extends Component{ 第{item[0].position}关 - + {item[0].name} diff --git a/public/react/src/modules/courses/poll/PollDetailIndex.js b/public/react/src/modules/courses/poll/PollDetailIndex.js index a141db961..e92a0e352 100644 --- a/public/react/src/modules/courses/poll/PollDetailIndex.js +++ b/public/react/src/modules/courses/poll/PollDetailIndex.js @@ -136,7 +136,7 @@ class PollDetailIndex extends Component{ - this.props.history.goBack()}>返回 + 返回

    diff --git a/public/react/src/modules/courses/poll/PollInfo.js b/public/react/src/modules/courses/poll/PollInfo.js index bce3d2753..2476e0bc3 100644 --- a/public/react/src/modules/courses/poll/PollInfo.js +++ b/public/react/src/modules/courses/poll/PollInfo.js @@ -327,7 +327,7 @@ class PollInfo extends Component{ {poll && poll.polls_name} { - isAdmin || (poll && poll.user_poll_status == 1) ? this.props.history.goBack()}>返回 :'' + isAdmin || (poll && poll.user_poll_status == 1) ? 返回 :'' }

    diff --git a/public/react/src/modules/courses/poll/PollNew.js b/public/react/src/modules/courses/poll/PollNew.js index ce602afc3..f8163b6a4 100644 --- a/public/react/src/modules/courses/poll/PollNew.js +++ b/public/react/src/modules/courses/poll/PollNew.js @@ -1,6 +1,9 @@ import React, {Component} from "react"; import {Form, Input, Tooltip, Checkbox, Radio, Select, message, Modal, Button} from 'antd' import {WordsBtn, ActionBtn} from 'educoder' + +import {Link} from 'react-router-dom' + import '../css/members.css' import "../common/formCommon.css" @@ -2412,8 +2415,7 @@ class PollNew extends Component {

    {this.props.match.params.news === undefined ? "新建问卷" : this.props.match.params.news === "new" ? "新建问卷" : "编辑问卷"}

    - this.gotohome()} - className=" fr font-16">返回 + 返回
    {/**/} From f80ed2fb2f54a2dce94c429b97b94bcd97efc63e Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Fri, 23 Aug 2019 15:28:39 +0800 Subject: [PATCH 30/30] =?UTF-8?q?=E5=AE=9E=E8=AE=AD=E4=BD=9C=E4=B8=9A?= =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=B8=BB=E7=9B=AE=E5=BD=95=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/models/homework_common.rb | 5 +++++ .../_homework_public_navigation.json.jbuilder | 1 + 2 files changed, 6 insertions(+) diff --git a/app/models/homework_common.rb b/app/models/homework_common.rb index 332aff045..790a9b7ab 100644 --- a/app/models/homework_common.rb +++ b/app/models/homework_common.rb @@ -80,6 +80,11 @@ class HomeworkCommon < ApplicationRecord end end + # 实训作业的主目录信息 + def main_category_info + {category_id: course.shixun_course_modules.take.try(:id), category_name: course.shixun_course_modules.take.try(:module_name)} + end + # 根据是否统一发布获取作业的作品列表 def all_works student_works = self.unified_setting ? self.student_works : diff --git a/app/views/homework_commons/_homework_public_navigation.json.jbuilder b/app/views/homework_commons/_homework_public_navigation.json.jbuilder index 243c6aecd..b5067e3c7 100644 --- a/app/views/homework_commons/_homework_public_navigation.json.jbuilder +++ b/app/views/homework_commons/_homework_public_navigation.json.jbuilder @@ -2,6 +2,7 @@ json.course_id course.id json.course_name course.name json.is_end course.is_end json.category homework.category_info +json.main_category homework.main_category_info if homework.homework_type == "practice" member = course.course_members.find_by(user_id: user.id, is_active: 1) curr_status = homework_curr_status(homework, user.course_identity(course), course, member, member&.teacher_course_groups) json.homework_status curr_status[:status]