From 42f1bb635378075e412ba5c88e2f5e34216d5e06 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Sat, 2 Nov 2019 15:39:19 +0800 Subject: [PATCH 01/11] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/exercises_controller.rb | 1 + 1 file changed, 1 insertion(+) diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index a6464a151..e5582ab87 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -1116,6 +1116,7 @@ class ExercisesController < ApplicationController # 学生提交试卷 def commit_exercise + tip_exception(-1, "试卷已提交") if @answer_committed_user.commit_status == 1 ActiveRecord::Base.transaction do begin can_commit_exercise = false From 93dffbe1228d8f225d980076d26161d4abcee13a Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 4 Nov 2019 13:52:32 +0800 Subject: [PATCH 02/11] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E7=9A=84=E8=B0=83?= =?UTF-8?q?=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/helpers/exercises_helper.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb index 395d67913..69a8d4ca1 100644 --- a/app/helpers/exercises_helper.rb +++ b/app/helpers/exercises_helper.rb @@ -502,7 +502,7 @@ module ExercisesHelper exercise_cha_score = 0.0 answer_status = 0 # if game.status == 2 && game.final_score >= 0 - if game.final_score > 0 + if game.final_score > 0 && game.end_time < exercise.end_time exercise_cha_score = game.real_score(exercise_cha.question_score) # exercise_cha_score = exercise_cha.question_score #每一关卡的得分 answer_status = 1 From 9353fc9b7ce982ec0051a59939782e8934d5ff35 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 4 Nov 2019 17:27:57 +0800 Subject: [PATCH 03/11] =?UTF-8?q?=E8=AF=BE=E5=A0=82=E8=AE=A8=E8=AE=BA?= =?UTF-8?q?=E5=8C=BA=E7=9A=84=E9=82=AE=E4=BB=B6=E9=80=9A=E7=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/controllers/messages_controller.rb | 9 +++ app/mailers/user_mailer.rb | 7 +++ .../user_mailer/course_message_email.html.erb | 62 +++++++++++++++++++ .../user_mailer/course_message_email.text.erb | 1 + ...191104080912_add_email_notify_to_course.rb | 5 ++ 5 files changed, 84 insertions(+) create mode 100644 app/views/user_mailer/course_message_email.html.erb create mode 100644 app/views/user_mailer/course_message_email.text.erb create mode 100644 db/migrate/20191104080912_add_email_notify_to_course.rb diff --git a/app/controllers/messages_controller.rb b/app/controllers/messages_controller.rb index 2302272bf..c1e08d440 100644 --- a/app/controllers/messages_controller.rb +++ b/app/controllers/messages_controller.rb @@ -125,6 +125,9 @@ class MessagesController < ApplicationController @message.message_detail_attributes = {content: params[:content]} @message.save! Attachment.associate_container(params[:attachment_ids], @message.id, @message.class.name) + if @board.course.email_notify && params[:email_notify] + notify_course_students @message, @board.course + end rescue Exception => e uid_logger_error(e.message) tip_exception(e.message) @@ -201,4 +204,10 @@ class MessagesController < ApplicationController def message_params params.require(:message).permit(:subject, :sticky) end + + def notify_course_students message, course + course.students.includes(:user).each do |student| + UserMailer.course_message_email(student&.user&.mail, message.id).deliver_now if student&.user&.mail + end + end end diff --git a/app/mailers/user_mailer.rb b/app/mailers/user_mailer.rb index 03ef63bb2..5cd9d787c 100644 --- a/app/mailers/user_mailer.rb +++ b/app/mailers/user_mailer.rb @@ -7,4 +7,11 @@ class UserMailer < ApplicationMailer @code = code mail(to: mail, subject: '验证你的电子邮件') end + + # 课堂讨论区的邮件通知 + def course_message_email(mail, message_id) + @message = Message.find_by(id: message_id) + @course = @message&.board&.course + mail(to: mail, subject: '课堂通知') if @message.present? && @course.present? + end end diff --git a/app/views/user_mailer/course_message_email.html.erb b/app/views/user_mailer/course_message_email.html.erb new file mode 100644 index 000000000..66c75414b --- /dev/null +++ b/app/views/user_mailer/course_message_email.html.erb @@ -0,0 +1,62 @@ + + + + <%= @course.name %>通知 + + + + + +
+
+
+ + + +
+
+
+

+ 您好! +

+

+ 您正在注册Educoder,请在10分钟内在注册页输入此验证码,并进行下一步操作。 + 如非你本人操作,请忽略此邮件。 +

+
+
+

<%= @code %>

+
+ + 此邮件为系统所发,请勿直接回复。
+ 要解决问题或了解您的帐户详情,您可以访问 帮助中心。 +
+
+

+ 如果您并未发过此请求,则可能是因为其他用户在注册时误输了您的邮件地址,而使您收到了这封邮件,那么您可以放心的忽略此邮件,无需进一步采取任何操作。 +

+
+
+ www.educoder.net +
+
+
+ + diff --git a/app/views/user_mailer/course_message_email.text.erb b/app/views/user_mailer/course_message_email.text.erb new file mode 100644 index 000000000..b6fc4c620 --- /dev/null +++ b/app/views/user_mailer/course_message_email.text.erb @@ -0,0 +1 @@ +hello \ No newline at end of file diff --git a/db/migrate/20191104080912_add_email_notify_to_course.rb b/db/migrate/20191104080912_add_email_notify_to_course.rb new file mode 100644 index 000000000..5a817781c --- /dev/null +++ b/db/migrate/20191104080912_add_email_notify_to_course.rb @@ -0,0 +1,5 @@ +class AddEmailNotifyToCourse < ActiveRecord::Migration[5.2] + def change + add_column :courses, :email_notify, :boolean, default: 0 + end +end From aba3456560d833c4e16c3295b73774e9f15edf65 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 4 Nov 2019 17:31:44 +0800 Subject: [PATCH 04/11] =?UTF-8?q?=E4=BD=9C=E4=B8=9A=E8=AF=84=E8=AE=BA?= =?UTF-8?q?=E7=9A=84xss?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- app/views/graduation_topics/_graduation_comments.json.jbuilder | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/views/graduation_topics/_graduation_comments.json.jbuilder b/app/views/graduation_topics/_graduation_comments.json.jbuilder index 51551d95d..b9314aa25 100644 --- a/app/views/graduation_topics/_graduation_comments.json.jbuilder +++ b/app/views/graduation_topics/_graduation_comments.json.jbuilder @@ -3,7 +3,7 @@ json.author do end json.id message.id -json.content message.contents_show(identity) +json.content content_safe(message.contents_show(identity)) json.time time_from_now(message.created_at) json.hidden message.hidden # 主贴与子贴不一致 From a52633e9e3af5ea5998caf9a2e92138664448d11 Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Mon, 4 Nov 2019 21:32:49 +0800 Subject: [PATCH 05/11] =?UTF-8?q?=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...91104132649_migrate_2796_exercise_score.rb | 60 +++++++++++++++++++ 1 file changed, 60 insertions(+) create mode 100644 db/migrate/20191104132649_migrate_2796_exercise_score.rb diff --git a/db/migrate/20191104132649_migrate_2796_exercise_score.rb b/db/migrate/20191104132649_migrate_2796_exercise_score.rb new file mode 100644 index 000000000..375116e94 --- /dev/null +++ b/db/migrate/20191104132649_migrate_2796_exercise_score.rb @@ -0,0 +1,60 @@ +class Migrate2796ExerciseScore < ActiveRecord::Migration[5.2] + def calculate_student_score(exercise,user) + score1 = 0.0 #实训题 + exercise_questions = exercise.exercise_questions.includes(:exercise_standard_answers) + exercise_questions.each do |q| + answers_content = q.exercise_answers.where(user_id: user.id) #学生的答案 + if q.question_type <= 2 #为选择题或判断题时 + if answers_content.present? #学生有回答时 + answer_choice_array = [] + answers_content.each do |a| + answer_choice_array.push(a.exercise_choice.choice_position) #学生答案的位置 + 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).sort + end + + if user_answer_content == standard_answer #答案一致,多选或单选才给分,答案不对不给分 + if standard_answer.size > 0 + q_score_1 = q.question_score + # q_score_1 = (q.question_score.to_f / standard_answer.count) #当多选答案正确时,每个answer的分数均摊。 + else + q_score_1 = 0.0 + end + answers_content.update_all(:score => q_score_1) + score1 = score1 + q.question_score + else + answers_content.update_all(:score => -1.0) + score1 += 0.0 + end + else + score1 += 0.0 + end + end + end + score1 + end + + def change + exercise = Exercise.find_by(id: 2796) + if exercise + exercise_users = exercise.exercise_users.where("start_at is not null and commit_status = 0") + exercise_users.each do |exercise_user| + calculate_score = calculate_student_score(exercise, exercise_user.user) + subjective_score = exercise_user.subjective_score + total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score + total_score = calculate_score + total_score_subjective_score + if exercise_user.end_at.nil? + exercise_user.update_attributes!(score:total_score,objective_score:calculate_score,end_at:exercise.end_time,commit_status:1,status:1,commit_method:3) + else + exercise_user.update_attributes!(score:total_score,objective_score:calculate_score) + end + puts exercise_user.id + end + end + end +end From de89189641a42e6c500d1cbf7c2aee80443c1e1e Mon Sep 17 00:00:00 2001 From: cxt <853663049@qq.com> Date: Tue, 5 Nov 2019 14:56:44 +0800 Subject: [PATCH 06/11] =?UTF-8?q?=E8=AF=95=E5=8D=B7=E7=9A=84=E7=AB=8B?= =?UTF-8?q?=E5=8D=B3=E6=88=AA=E6=AD=A2=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../exercise_answers_controller.rb | 2 +- app/controllers/exercises_controller.rb | 4 +- app/helpers/exercises_helper.rb | 7 +- app/jobs/end_exercise_calculate_job.rb | 4 +- app/models/exercise.rb | 2 +- app/tasks/exercise_publish_task.rb | 102 ++++++++---------- lib/tasks/poll_publish.rake | 2 +- 7 files changed, 57 insertions(+), 66 deletions(-) diff --git a/app/controllers/exercise_answers_controller.rb b/app/controllers/exercise_answers_controller.rb index b1e23071b..4b94676e5 100644 --- a/app/controllers/exercise_answers_controller.rb +++ b/app/controllers/exercise_answers_controller.rb @@ -107,7 +107,7 @@ class ExerciseAnswersController < ApplicationController normal_status(-1,"已提交/已结束的试卷不允许修改!") else if (@exercise_user_status == Exercise::DEADLINE && @exercise_user.commit_status == 0) || (@exercise.time > 0 && @exercise_user.start_at.present? && ((@exercise_user.start_at + @exercise.time.to_i.minutes) < Time.now)) - objective_score = calculate_student_score(@exercise,current_user)[:total_score] + objective_score = calculate_student_score(@exercise,current_user,Time.now)[:total_score] subjective_score = @exercise_user.subjective_score < 0.0 ? 0.0 : @exercise_user.subjective_score total_score = objective_score + subjective_score commit_option = { diff --git a/app/controllers/exercises_controller.rb b/app/controllers/exercises_controller.rb index 3b4d65a1f..97e0593d8 100644 --- a/app/controllers/exercises_controller.rb +++ b/app/controllers/exercises_controller.rb @@ -886,7 +886,7 @@ class ExercisesController < ApplicationController ex_user_ids = exercise_users.pluck(:id) - EndExerciseCalculateJob.perform_later(ex_user_ids,exercise) + EndExerciseCalculateJob.perform_later(ex_user_ids,exercise,Time.now) # exercise_users.each do |user| # if user.commit_status == 0 && user.start_at.present? # objective_score = calculate_student_score(exercise,user.user)[:total_score] @@ -1141,7 +1141,7 @@ class ExercisesController < ApplicationController can_commit_exercise = true end if can_commit_exercise - objective_score = calculate_student_score(@exercise,current_user)[:total_score] + objective_score = calculate_student_score(@exercise,current_user,Time.now)[:total_score] subjective_score = @answer_committed_user.subjective_score total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score total_score = objective_score + total_score_subjective_score diff --git a/app/helpers/exercises_helper.rb b/app/helpers/exercises_helper.rb index 41d2a748e..44c341d6e 100644 --- a/app/helpers/exercises_helper.rb +++ b/app/helpers/exercises_helper.rb @@ -412,12 +412,13 @@ module ExercisesHelper end #计算试卷的总分和试卷的答题状态 - def calculate_student_score(exercise,user) + def calculate_student_score(exercise,user,end_time) score1 = 0.0 #选择题/判断题 score2 = 0.0 #填空题 score5 = 0.0 #实训题 ques_stand = [] #问题是否正确 - exercise_questions = exercise.exercise_questions.includes(:exercise_answers,:exercise_shixun_answers,:exercise_standard_answers,:exercise_shixun_challenges) + exercise_end_time = end_time || Time.now + exercise_questions = exercise.exercise_questions.includes(:exercise_standard_answers,:exercise_shixun_challenges) exercise_questions&.each do |q| begin if q.question_type != 5 @@ -505,7 +506,7 @@ module ExercisesHelper exercise_cha_score = 0.0 answer_status = 0 # if game.status == 2 && game.final_score >= 0 - if game.final_score > 0 && game.end_time < exercise.end_time + if game.final_score > 0 && game.end_time && game.end_time < exercise_end_time exercise_cha_score = game.real_score(exercise_cha.question_score) # exercise_cha_score = exercise_cha.question_score #每一关卡的得分 answer_status = 1 diff --git a/app/jobs/end_exercise_calculate_job.rb b/app/jobs/end_exercise_calculate_job.rb index b6d8e491e..35c6ded57 100644 --- a/app/jobs/end_exercise_calculate_job.rb +++ b/app/jobs/end_exercise_calculate_job.rb @@ -5,11 +5,11 @@ class EndExerciseCalculateJob < ApplicationJob queue_as :default - def perform(ex_user_ids,exercise) + def perform(ex_user_ids,exercise,end_time) exercise_users = ExerciseUser.where(id: ex_user_ids) exercise_users.each do |user| if user.commit_status == 0 && user.start_at.present? - objective_score = calculate_student_score(exercise,user.user)[:total_score] + objective_score = calculate_student_score(exercise,user.user,end_time)[:total_score] user_sub_score = user.subjective_score subjective_score = user_sub_score < 0.0 ? 0.0 : user_sub_score total_score = objective_score + subjective_score diff --git a/app/models/exercise.rb b/app/models/exercise.rb index 0b9963eee..177c0ac88 100644 --- a/app/models/exercise.rb +++ b/app/models/exercise.rb @@ -70,7 +70,7 @@ class Exercise < ApplicationRecord if unified_setting self&.end_time else - user_course_group = course.course_members.find_by(user_id: user_id)&.course_group_id + user_course_group = course.students.find_by(user_id: user_id)&.course_group_id exercise_group_settings.find_by(course_group_id:user_course_group)&.end_time end end diff --git a/app/tasks/exercise_publish_task.rb b/app/tasks/exercise_publish_task.rb index 04e37d126..6aa444683 100644 --- a/app/tasks/exercise_publish_task.rb +++ b/app/tasks/exercise_publish_task.rb @@ -41,20 +41,21 @@ class ExercisePublishTask puts "--------------------------------exercise_publish end" end + def end Rails.logger.info("log--------------------------------exercise_end start") puts "--------------------------------exercise_end start" # 1。统一设置的试卷 - exercises = Exercise.includes(:exercise_users,:exercise_questions).where("exercise_status = 2 AND - unified_setting = true AND end_time <= ?",Time.now + 900) - exercises&.each do |exercise| - ex_type = exercise.exercise_questions.pluck(:question_type).uniq + exercises = Exercise.includes(:exercise_questions).where("exercise_status = 2 AND end_time <= ?",Time.now + 900) + exercises.each do |exercise| + Rails.logger.info("end_exercise_id: #{exercise.id}") exercise.update_column('exercise_status', 3) - exercise.exercise_users&.each do |exercise_user| - begin - Rails.logger.info("true: user_id:#{exercise_user.user_id}--commit_status:#{exercise_user.commit_status}") - if (exercise_user&.commit_status == 0) && (exercise_user&.start_at.present?) - s_score = calculate_student_score(exercise, exercise_user.user)[:total_score] + if exercise.unified_setting + ex_type = exercise.exercise_questions.pluck(:question_type).uniq + exercise.exercise_users.where("commit_status = 0 and start_at is not null").each do |exercise_user| + begin + Rails.logger.info("true: user_id:#{exercise_user.user_id}--commit_status:#{exercise_user.commit_status}") + s_score = calculate_student_score(exercise, exercise_user.user, exercise.end_time)[:total_score] if ex_type.include?(4) #是否包含主观题 subjective_score = exercise_user.subjective_score else @@ -66,72 +67,61 @@ class ExercisePublishTask Rails.logger.info("true: user_id:#{exercise_user.user_id}--s_score:#{s_score}") Rails.logger.info("true: user_id:#{exercise_user.user_id}--commit_method:#{exercise_user.commit_method}") commit_option = { - :status => 1, - :commit_status => 1, - :end_at => Time.now, - :objective_score => s_score, - :score => total_score, - :subjective_score => subjective_score, - :commit_method => exercise_user&.commit_method.to_i > 0 ? exercise_user&.commit_method.to_i : 3 + :status => 1, + :commit_status => 1, + :end_at => exercise.end_time, + :objective_score => s_score, + :score => total_score, + :subjective_score => subjective_score, + :commit_method => exercise_user&.commit_method.to_i > 0 ? exercise_user&.commit_method.to_i : 3 } exercise_user.update_attributes(commit_option) + rescue Exception => e + Rails.logger.info("rescue errors ___________________________#{e}") + next end - rescue Exception => e - Rails.logger.info("rescue errors ___________________________#{e}") - next end - end end - # 2.非统一的试卷 - all_exercises = Exercise.includes(:exercise_group_settings,:exercise_users,:exercise_questions).where("unified_setting = false AND exercise_status = 2 AND end_time > ?",Time.now + 900) - exercise_ids = all_exercises.blank? ? "(-1)" : "(" + all_exercises.map(&:id).join(",") + ")" - ex_group_settings = ExerciseGroupSetting.where("end_time <= '#{Time.now}' and exercise_id in #{exercise_ids}") - ex_group_settings&.each do |exercise_setting| + ExerciseGroupSetting.where("end_time < ? and end_time > ?", Time.now + 900, Time.now - 900).each do |exercise_setting| exercise = exercise_setting.exercise - if exercise.end_time <= Time.now - exercise.update_column('exercise_status', 3) - end + Rails.logger.info("exercise_group_setting: exercise_id:#{exercise.id}--group_settings_id:#{exercise_setting.id}") + users = exercise.course.course_members.where(:course_group_id => exercise_setting.course_group_id) + exercise_users = exercise.exercise_users.where(user_id: users.pluck(:user_id)).where("commit_status = 0 and start_at is not null") ex_types = exercise.exercise_questions.pluck(:question_type).uniq - users = exercise.course.students.where(:course_group_id => exercise_setting.course_group_id) - exercise_users = exercise.exercise_users.where(:user_id => users.pluck(:user_id)) - exercise_users&.each do |exercise_user| + exercise_users.each do |exercise_user| + Rails.logger.info("false: user_id:#{exercise_user.user_id}--commit_status:#{exercise_user.commit_status}") begin - Rails.logger.info("false: user_id:#{exercise_user.user_id}--commit_status:#{exercise_user.commit_status}") - if exercise_user.commit_status == 0 && !exercise_user.start_at.nil? - if ex_types.include?(4) #是否包含主观题 - subjective_score = exercise_user.subjective_score - else - subjective_score = -1.0 - end - s_score = calculate_student_score(exercise, exercise_user.user)[:total_score] - total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score - total_score = s_score + total_score_subjective_score - Rails.logger.info("false: user_id:#{exercise_user.user_id}--s_score:#{s_score}") - Rails.logger.info("false: user_id:#{exercise_user.user_id}--subjective_score:#{subjective_score}") - Rails.logger.info("false: user_id:#{exercise_user.user_id}--commit_method:#{exercise_user.commit_method}") - commit_option = { - :status => 1, - :commit_status => 1, - :end_at => Time.now, - :objective_score => s_score, - :score => total_score, - :subjective_score => subjective_score, - :commit_method => exercise_user&.commit_method.to_i > 0 ? exercise_user&.commit_method.to_i : 3 - } - exercise_user.update_attributes(commit_option) + if ex_types.include?(4) #是否包含主观题 + subjective_score = exercise_user.subjective_score + else + subjective_score = -1.0 end + s_score = calculate_student_score(exercise, exercise_user.user, exercise_setting.end_time)[:total_score] + total_score_subjective_score = subjective_score < 0.0 ? 0.0 : subjective_score + total_score = s_score + total_score_subjective_score + Rails.logger.info("false: user_id:#{exercise_user.user_id}--s_score:#{s_score}") + Rails.logger.info("false: user_id:#{exercise_user.user_id}--subjective_score:#{subjective_score}") + Rails.logger.info("false: user_id:#{exercise_user.user_id}--commit_method:#{exercise_user.commit_method}") + commit_option = { + :status => 1, + :commit_status => 1, + :end_at => exercise_setting.end_time, + :objective_score => s_score, + :score => total_score, + :subjective_score => subjective_score, + :commit_method => exercise_user&.commit_method.to_i > 0 ? exercise_user&.commit_method.to_i : 3 + } + exercise_user.update_attributes(commit_option) rescue Exception => e Rails.logger.info("unified_setting_false_rescue errors ___________________________#{e}") next end - end end Rails.logger.info("log--------------------------------exercise_end end") puts "--------------------------------exercise_end end" end - end \ No newline at end of file diff --git a/lib/tasks/poll_publish.rake b/lib/tasks/poll_publish.rake index 2460e88c9..1b6d63bcc 100644 --- a/lib/tasks/poll_publish.rake +++ b/lib/tasks/poll_publish.rake @@ -110,7 +110,7 @@ namespace :poll_publish do # # end # end - PollGroupSetting.where("end_time < ? and end_time > ?", Time.now + 1800, Time.now - 1800).each do |poll_setting| + PollGroupSetting.where("end_time < ? and end_time > ?", Time.now + 900, Time.now - 900).each do |poll_setting| poll = poll_setting.poll # poll.update_column('polls_status',3) From 0972872cfea85df2fa588d1aab0cf0a9c6e983f9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9D=A8=E6=A0=91=E6=9E=97?= <904079904@qq.com> Date: Tue, 5 Nov 2019 15:20:20 +0800 Subject: [PATCH 07/11] =?UTF-8?q?=E8=B0=83=E6=95=B4=E8=AF=95=E5=8D=B7?= =?UTF-8?q?=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../courses/exercise/new/SingleEditor.js | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/public/react/src/modules/courses/exercise/new/SingleEditor.js b/public/react/src/modules/courses/exercise/new/SingleEditor.js index f3c917c75..624315817 100644 --- a/public/react/src/modules/courses/exercise/new/SingleEditor.js +++ b/public/react/src/modules/courses/exercise/new/SingleEditor.js @@ -224,6 +224,10 @@ class SingleEditor extends Component{ // [true, false, true] -> [0, 2] const answerTagArray = standard_answers.map((item, index) => { return item == true ? tagArray[index] : -1 }).filter(item => item != -1); + console.log("xuanzheshijuan"); + console.log(answerTagArray); + console.log(!exerciseIsPublish); + return(