From 7c43868a65c78b1f2859e047f86a87c53a0a0652 Mon Sep 17 00:00:00 2001 From: lingdocs <71590811+lingdocs@users.noreply.github.com> Date: Mon, 9 May 2022 17:55:15 -0500 Subject: [PATCH] proper answer feedback on the identifying one --- src/games/sub-cores/EquativeGame.tsx | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/games/sub-cores/EquativeGame.tsx b/src/games/sub-cores/EquativeGame.tsx index 688ce7b..e52ef13 100644 --- a/src/games/sub-cores/EquativeGame.tsx +++ b/src/games/sub-cores/EquativeGame.tsx @@ -164,8 +164,21 @@ export default function EquativeGame({ id, link, level }: { id: string, link: st if (wasCorrect) { return callback(wasCorrect); } else { - callback(
- {humanReadableTense(question.EPS.equative.tense)} + const possibleCorrect = tenses.filter(tn => { + const r = renderEP({ + ...question.EPS, + equative: { + ...question.EPS.equative, + tense: tn, + }, + }); + const c = compileEP(r, true); + return c.ps.some(a => ( + question.phrase.ps.some(b => psStringEquals(a, b)) + )); + }); + callback(
+ {makeCorrectTenseAnswer(possibleCorrect)}
) } } @@ -258,6 +271,12 @@ export default function EquativeGame({ id, link, level }: { id: string, link: st /> }; +function makeCorrectTenseAnswer(tenses: T.EquativeTense[]): string { + return tenses.reduce((accum, curr, i) => ( + `${accum}${(i > 0 ? " or " : " ")}'${humanReadableTense(curr)}'` + ), ""); +} + function makeCorrectAnswer(question: Question): JSX.Element { return