このコミットが含まれているのは:
@@ -27,12 +27,11 @@ class GekanatorGamesController < ApplicationController
|
||||
game = GekanatorGame.find_by(id: params[:id])
|
||||
return head :not_found unless game
|
||||
|
||||
asked_ids = Array(game.answers).filter_map { |answer|
|
||||
answer['questionId'] || answer[:questionId]
|
||||
}
|
||||
asked_ids = Array(game.answers).filter_map { |answer| answer_question_id(answer) }
|
||||
existing_example_ids =
|
||||
GekanatorQuestionExample.where(post_id: game.correct_post_id)
|
||||
.select(:gekanator_question_id)
|
||||
# Direct examples only for now; post_similarity-based expansion is deferred.
|
||||
questions =
|
||||
GekanatorQuestion
|
||||
.accepted
|
||||
@@ -64,7 +63,7 @@ class GekanatorGamesController < ApplicationController
|
||||
|
||||
answers = answer_params.map { |answer|
|
||||
{
|
||||
question_id: answer.require(:question_id),
|
||||
question_id: answer.require(:question_id).to_i,
|
||||
answer: answer.require(:answer)
|
||||
}
|
||||
}
|
||||
@@ -107,4 +106,13 @@ class GekanatorGamesController < ApplicationController
|
||||
priority_weight: question.priority_weight
|
||||
}
|
||||
end
|
||||
|
||||
def answer_question_id answer
|
||||
value = if answer.is_a?(Hash)
|
||||
answer['question_id'].presence || answer[:question_id].presence ||
|
||||
answer['questionId'].presence || answer[:questionId].presence
|
||||
end
|
||||
|
||||
value&.to_s
|
||||
end
|
||||
end
|
||||
|
||||
新しい課題から参照
ユーザをブロックする