diff --git a/app/services/examination_banks/send_to_course_service.rb b/app/services/examination_banks/send_to_course_service.rb index bb30e1992..012aa282b 100644 --- a/app/services/examination_banks/send_to_course_service.rb +++ b/app/services/examination_banks/send_to_course_service.rb @@ -10,6 +10,7 @@ class ExaminationBanks::SendToCourseService < ApplicationService ActiveRecord::Base.transaction do exercise.exercise_name = exam.name exercise.time = exam.duration.present? ? exam.duration : -1 + exercise.is_md = false exercise.save! exam.examination_items.each_with_index do |item, index| @@ -18,7 +19,6 @@ class ExaminationBanks::SendToCourseService < ApplicationService question.question_title = item.name question.question_number = index + 1 question.question_score = item.score - question.is_md = false if item.item_type == "PROGRAM" new_hack = item.container.fork diff --git a/app/views/exercise_questions/_exercise_questions.json.jbuilder b/app/views/exercise_questions/_exercise_questions.json.jbuilder index 8359dbe98..043dede07 100644 --- a/app/views/exercise_questions/_exercise_questions.json.jbuilder +++ b/app/views/exercise_questions/_exercise_questions.json.jbuilder @@ -1,5 +1,4 @@ json.question_id question.id -json.is_md question.is_md q_positon = question.question_number if ques_position.present? q_positon = ques_position diff --git a/app/views/exercises/_user_exercise_info.json.jbuilder b/app/views/exercises/_user_exercise_info.json.jbuilder index c351a9b26..3e2e356ec 100644 --- a/app/views/exercises/_user_exercise_info.json.jbuilder +++ b/app/views/exercises/_user_exercise_info.json.jbuilder @@ -1,5 +1,5 @@ json.exercise do - json.extract! exercise, :id, :exercise_name,:exercise_description,:exercise_status,:answer_open + json.extract! exercise, :id, :exercise_name,:exercise_description,:exercise_status,:answer_open,:is_md json.student_commit_status student_status #当前为学生且已提交时 end diff --git a/app/views/exercises/edit.json.jbuilder b/app/views/exercises/edit.json.jbuilder index 980e6735a..1c8f1cf71 100644 --- a/app/views/exercises/edit.json.jbuilder +++ b/app/views/exercises/edit.json.jbuilder @@ -3,7 +3,7 @@ json.left_banner_name @left_banner_name json.partial! "commons/success" json.exercise do - json.extract! @exercise, :id, :exercise_name,:exercise_description,:exercise_status + json.extract! @exercise, :id, :exercise_name,:exercise_description,:exercise_status,:is_md end json.partial! "exercises/exercise_scores" diff --git a/app/views/exercises/show.json.jbuilder b/app/views/exercises/show.json.jbuilder index afd15e8e7..bc06dc638 100644 --- a/app/views/exercises/show.json.jbuilder +++ b/app/views/exercises/show.json.jbuilder @@ -1,7 +1,7 @@ json.partial! "commons/success" json.exercise do - json.extract! @exercise, :id, :exercise_name,:exercise_description,:exercise_status + json.extract! @exercise, :id, :exercise_name,:exercise_description,:exercise_status,:is_md end json.user_permission do diff --git a/app/views/exercises/start_answer.json.jbuilder b/app/views/exercises/start_answer.json.jbuilder index 01b730c76..26c5f38fd 100644 --- a/app/views/exercises/start_answer.json.jbuilder +++ b/app/views/exercises/start_answer.json.jbuilder @@ -2,7 +2,7 @@ all_question_status = [] json.left_banner_id @left_banner_id json.left_banner_name @left_banner_name json.exercise do - json.extract! @exercise,:id,:exercise_name,:exercise_description + json.extract! @exercise,:id,:exercise_name,:exercise_description,:is_md json.exercise_status @t_user_exercise_status json.left_time @user_left_time json.user_exercise_status @user_exercise_status #当前用户的状态 diff --git a/db/migrate/20200326022655_add_is_md_to_exercise.rb b/db/migrate/20200326022655_add_is_md_to_exercise.rb new file mode 100644 index 000000000..09fd71a1a --- /dev/null +++ b/db/migrate/20200326022655_add_is_md_to_exercise.rb @@ -0,0 +1,6 @@ +class AddIsMdToExercise < ActiveRecord::Migration[5.2] + def change + remove_column :exercise_questions, :is_md + add_column :exercises, :is_md, :boolean, default: 1 + end +end