bug fix
This commit is contained in:
parent
dad93bfa14
commit
37dbea50b5
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "@lingdocs/pashto-inflector",
|
"name": "@lingdocs/pashto-inflector",
|
||||||
"version": "1.9.1",
|
"version": "1.9.2",
|
||||||
"author": "lingdocs.com",
|
"author": "lingdocs.com",
|
||||||
"description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations",
|
"description": "A Pashto inflection and verb conjugation engine, inculding React components for displaying Pashto text, inflections, and conjugations",
|
||||||
"homepage": "https://verbs.lingdocs.com",
|
"homepage": "https://verbs.lingdocs.com",
|
||||||
|
|
|
@ -84,7 +84,8 @@ export function VPExplorer(props: {
|
||||||
useEffect(() => {
|
useEffect(() => {
|
||||||
setVps(o => {
|
setVps(o => {
|
||||||
if (mode === "quiz") {
|
if (mode === "quiz") {
|
||||||
const { VPS, qs } = makeQuizState(vps);
|
const newvps = makeVPSelectionState(props.verb, o);
|
||||||
|
const { VPS, qs } = makeQuizState(newvps);
|
||||||
setQuizState(qs);
|
setQuizState(qs);
|
||||||
return VPS;
|
return VPS;
|
||||||
}
|
}
|
||||||
|
@ -331,11 +332,16 @@ function makeQuizState(oldVps: T.VPSelectionState): { VPS: T.VPSelectionState, q
|
||||||
}
|
}
|
||||||
const vps = getRandomVPSelection("both")(oldVps);
|
const vps = getRandomVPSelection("both")(oldVps);
|
||||||
const wrongStates: T.VPSelectionState[] = [];
|
const wrongStates: T.VPSelectionState[] = [];
|
||||||
[1, 2, 3, 4].forEach(() => {
|
// don't do the SO switches every time
|
||||||
|
const wholeTimeSOSwitch = randFromArray([true, false]);
|
||||||
|
[1, 2, 3].forEach(() => {
|
||||||
// TODO: don't repeat tenses
|
// TODO: don't repeat tenses
|
||||||
let v: T.VPSelectionState;
|
let v: T.VPSelectionState;
|
||||||
do {
|
do {
|
||||||
v = getRandomVPSelection("tenses")(vps);
|
const SOSwitch = wholeTimeSOSwitch && randFromArray([true, false]);
|
||||||
|
v = getRandomVPSelection("tenses")(
|
||||||
|
SOSwitch ? switchSubjObj(vps) : vps,
|
||||||
|
);
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
} while (wrongStates.find(x => x.verb.tense === v.verb.tense));
|
} while (wrongStates.find(x => x.verb.tense === v.verb.tense));
|
||||||
wrongStates.push(v);
|
wrongStates.push(v);
|
||||||
|
@ -370,9 +376,10 @@ function getOptionFromResult(r: {
|
||||||
ps: T.SingleOrLengthOpts<T.PsString[]>;
|
ps: T.SingleOrLengthOpts<T.PsString[]>;
|
||||||
e?: string[] | undefined;
|
e?: string[] | undefined;
|
||||||
}): T.PsString {
|
}): T.PsString {
|
||||||
// TODO: randomize length pick
|
const ps = "long" in r.ps
|
||||||
const ps = "long" in r.ps ? r.ps.long : r.ps;
|
? r.ps[randFromArray(["short", "long"] as ("short" | "long")[])]
|
||||||
// TODO: randomize version pick
|
: r.ps;
|
||||||
|
// not randomizing version pick (for now)
|
||||||
return ps[0];
|
return ps[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue