选择题答案问题

dev_course
daiao 5 years ago
parent 358e02c626
commit 716b5af39f

@ -226,14 +226,15 @@ class GamesController < ApplicationController
# 0 直接查看答案, 1 查看答案弹框, 2 答案详情弹框 # 0 直接查看答案, 1 查看答案弹框, 2 答案详情弹框
def get_answer_info def get_answer_info
@challenge = @game.challenge @challenge = @game.challenge
@challenge_answers = if @challenge.st == 0 if @challenge.st == 0
@challenge.challenge_answers @challenge_answers = @challenge.challenge_answers
else else
result = [] result = []
@challenge.challenge_chooses.each do |choose| @challenge.challenge_chooses.each do |choose|
result << {:position => choose.position, :answer => (choose.answer.blank? ? choose.standard_answer : choose.answer)} result << {:position => choose.position, :answer => (choose.answer.blank? ? choose.standard_answer : choose.answer)}
end end
end @challenge_answers = result
end
# 平台已认证的老师需要控制 # 平台已认证的老师需要控制

@ -1,5 +1,6 @@
index = 0 index = 0
json.status 3 json.status 3
# st: 0 实践题 1 选择题
if @challenge.st == 0 if @challenge.st == 0
json.message do json.message do
json.array! @challenge_answers do |answer| json.array! @challenge_answers do |answer|

Loading…
Cancel
Save