diff --git a/app/controllers/games_controller.rb b/app/controllers/games_controller.rb index b490352bb..0142ef2ba 100644 --- a/app/controllers/games_controller.rb +++ b/app/controllers/games_controller.rb @@ -226,14 +226,15 @@ class GamesController < ApplicationController # 0 直接查看答案, 1 查看答案弹框, 2 答案详情弹框 def get_answer_info @challenge = @game.challenge - @challenge_answers = if @challenge.st == 0 - @challenge.challenge_answers - else - result = [] - @challenge.challenge_chooses.each do |choose| - result << {:position => choose.position, :answer => (choose.answer.blank? ? choose.standard_answer : choose.answer)} - end - end + if @challenge.st == 0 + @challenge_answers = @challenge.challenge_answers + else + result = [] + @challenge.challenge_chooses.each do |choose| + result << {:position => choose.position, :answer => (choose.answer.blank? ? choose.standard_answer : choose.answer)} + end + @challenge_answers = result + end # 平台已认证的老师需要控制 diff --git a/app/views/games/get_answer_info.json.jbuilder b/app/views/games/get_answer_info.json.jbuilder index 4cfebd856..57b180816 100644 --- a/app/views/games/get_answer_info.json.jbuilder +++ b/app/views/games/get_answer_info.json.jbuilder @@ -1,5 +1,6 @@ index = 0 json.status 3 +# st: 0 实践题 1 选择题 if @challenge.st == 0 json.message do json.array! @challenge_answers do |answer|