このコミットが含まれているのは:
2026-06-10 22:24:01 +09:00
コミット 480a06caaf
4個のファイルの変更28行の追加28行の削除
+12 -4
ファイルの表示
@@ -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
+1
ファイルの表示
@@ -10,6 +10,7 @@ module Gekanator
def call
suggestion.with_lock do
return promoted_question if suggestion.processed?
return suggestion if suggestion.answer == 'unknown'
question = GekanatorQuestion.create!(
text: suggestion.question_text,