diff --git a/app/controllers/poll_questions_controller.rb b/app/controllers/poll_questions_controller.rb index 59af29758..dfff147c4 100644 --- a/app/controllers/poll_questions_controller.rb +++ b/app/controllers/poll_questions_controller.rb @@ -202,8 +202,8 @@ class PollQuestionsController < ApplicationController if opr.to_s == "up" last_q_p = @poll.poll_questions.last_poll(current_q_p) #当前问题的前一个问题 if last_q_p.present? - @poll_question.update_attribute("question_number", (current_q_p - 1)) last_q_p.update_attribute("question_number", current_q_p) # 重新获取当前问题的位置 + @poll_question.update_attribute("question_number", (current_q_p - 1)) normal_status(0, "问题上移成功!") else normal_status(-1, "移动失败,已经是第一个问题了!") @@ -211,8 +211,8 @@ class PollQuestionsController < ApplicationController elsif opr.to_s == "down" next_q_p = @poll.poll_questions.next_poll(current_q_p) #当前问题的后一个问题 if next_q_p.present? - @poll_question.update_attribute("question_number", (current_q_p + 1)) next_q_p.update_attribute("question_number", current_q_p) + @poll_question.update_attribute("question_number", (current_q_p + 1)) normal_status(0, "问题下移成功!") else normal_status(-1, "移动失败,已经是最后一个问题了!")