proper answer feedback on the identifying one

This commit is contained in:
lingdocs 2022-05-09 17:55:15 -05:00
parent df68d3d12c
commit 7c43868a65
1 changed files with 21 additions and 2 deletions

View File

@ -164,8 +164,21 @@ export default function EquativeGame({ id, link, level }: { id: string, link: st
if (wasCorrect) {
return callback(wasCorrect);
} else {
callback(<div>
{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(<div className="lead">
{makeCorrectTenseAnswer(possibleCorrect)}
</div>)
}
}
@ -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 <div>
<div className="my-2">