选择题查看参考答案变化

dev_course
daiao 5 years ago
parent cbb2cf6d1d
commit b990d6b74e

@ -225,8 +225,17 @@ class GamesController < ApplicationController
# GET: /tasks/:identifier/get_answer_info
# 0 直接查看答案, 1 查看答案弹框, 2 答案详情弹框
def get_answer_info
challenge = @game.challenge
@challenge_answers = challenge.challenge_answers
@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
# 平台已认证的老师需要控制
@power = (@identity < User::EDU_GAME_MANAGER)
if !@power

@ -1,15 +1,25 @@
index = 0
json.status 3
json.message do
json.array! @challenge_answers do |answer|
index += 1
json.answer_id answer.id
json.answer_name answer.name
json.answer_score answer.score
# 高层级不给答案
if @power || @game.answer_open >= index
json.answer_contents answer.contents
if @challenge.st == 0
json.message do
json.array! @challenge_answers do |answer|
index += 1
json.answer_id answer.id
json.answer_name answer.name
json.answer_score answer.score
# 高层级不给答案
if @power || @game.answer_open >= index
json.answer_contents answer.contents
end
end
end
else
json.message do
json.array! @challenge_answers do |answer|
json.position answer[:postion]
json.answer_contents answer[:answer]
end
end
end

Loading…
Cancel
Save