试题预览页的删除单个试题

dev_jupyter
cxt 5 years ago
parent c7ebb446fe
commit 2bb43cecf4

@ -56,8 +56,9 @@ class ExaminationBanksController < ApplicationController
def set_public
tip_exception(-1, "该试卷已公开") if @exam.public?
@exam.update_attributes!(public: 1)
tip_exception(-1, "请勿重复提交申请") if ApplyAction.where(container: @exam).exists?
ApplyAction.create!(container: @exam, user_id: current_user.id)
# @exam.update_attributes!(public: 1)
render_ok
end

@ -37,7 +37,9 @@ class ItemBanksController < ApplicationController
def set_public
tip_exception(-1, "该试题已公开") if @item.public?
@item.update_attributes!(public: 1)
tip_exception(-1, "请勿重复提交申请") if ApplyAction.where(container: @item).exists?
ApplyAction.create!(container: @item, user_id: current_user.id)
# @item.update_attributes!(public: 1)
render_ok
end

@ -11,6 +11,7 @@ end
json.multiple_questions do
json.questions @multiple_questions.each do |question|
json.(question, :id, :position, :score, :item_type)
json.item_id question.item_bank_id
json.partial! "item_banks/item", locals: {item: question.item_bank}
end
json.questions_score @multiple_questions.map(&:score).sum
@ -20,6 +21,7 @@ end
json.judgement_questions do
json.questions @judgement_questions.each do |question|
json.(question, :id, :position, :score, :item_type)
json.item_id question.item_bank_id
json.partial! "item_banks/item", locals: {item: question.item_bank}
end
json.questions_score @judgement_questions.map(&:score).sum
@ -29,6 +31,7 @@ end
json.program_questions do
json.questions @program_questions.each do |question|
json.(question, :id, :position, :score, :item_type)
json.item_id question.item_bank_id
json.partial! "item_banks/item", locals: {item: question.item_bank}
end
json.questions_score @program_questions.map(&:score).sum

Loading…
Cancel
Save