diff --git a/app/controllers/examination_banks_controller.rb b/app/controllers/examination_banks_controller.rb index 96767c21b..3cb0efa84 100644 --- a/app/controllers/examination_banks_controller.rb +++ b/app/controllers/examination_banks_controller.rb @@ -56,6 +56,7 @@ class ExaminationBanksController < ApplicationController def set_public tip_exception(-1, "该试卷已公开") if @exam.public? + @exam.update_attributes!(public: 1) render_ok end diff --git a/app/controllers/item_baskets_controller.rb b/app/controllers/item_baskets_controller.rb index 21203346b..ebf5316f8 100644 --- a/app/controllers/item_baskets_controller.rb +++ b/app/controllers/item_baskets_controller.rb @@ -29,10 +29,9 @@ class ItemBasketsController < ApplicationController end def destroy - item = current_user.item_baskets.find_by!(item_bank_id: params[:id]) ActiveRecord::Base.transaction do - current_user.item_baskets.where(item_type: item.item_type).where("position > #{item.position}").update_all("position = position -1") - item.destroy! + current_user.item_baskets.where(item_type: current_basket.item_type).where("position > #{current_basket.position}").update_all("position = position -1") + current_basket.destroy! end render_ok end