feat(api): wire GameSessionStore into createGameSession
The service now tracks the correct optionId for each question and stores the answer key in the GameSessionStore after building the session. The client response is unchanged — the store is invisible to the outside. - Build answerKey (questionId → correctOptionId) during question assembly by finding the correct answer's position after shuffle - Store the answer key via gameSessionStore.create() before returning - Add excludeText parameter to getDistractors to prevent a distractor from having identical text to the correct answer (different term, same translation). Solved at the query level, not with post-filtering. - Module-level InMemoryGameSessionStore singleton in the service
This commit is contained in:
parent
1940ff3965
commit
0755c57439
2 changed files with 3 additions and 0 deletions
|
|
@ -22,6 +22,7 @@ export const createGameSession = async (
|
|||
correctAnswers.map(async (correctAnswer) => {
|
||||
const distractorTexts = await getDistractors(
|
||||
correctAnswer.termId,
|
||||
correctAnswer.targetText,
|
||||
request.target_language,
|
||||
request.pos,
|
||||
request.difficulty,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue