feat: improve lesson selection logic to prioritize topics with available phrases
Browse files- static/index.html +3 -2
static/index.html
CHANGED
|
@@ -2867,7 +2867,7 @@ function setRound(){
|
|
| 2867 |
box.checked=all; box.disabled=!todo.length;
|
| 2868 |
order=all?topic:todo; pos=0; marks();
|
| 2869 |
}
|
| 2870 |
-
function startCat(wait=true){ if(!CATS.length) return marks(); setRound(); show(null,bubbleCat()?false:wait); }
|
| 2871 |
// What tells how much was practised, redrawn when a score comes in: the path and the box's text. The count itself is in the list's title.
|
| 2872 |
function marks(){
|
| 2873 |
drawPath(); // with no topic yet, the path still shows what is to come
|
|
@@ -5975,7 +5975,8 @@ $("labNext").onclick=()=>{ const k=LAB.items.findIndex(x=>x.id===labAt); labOpen
|
|
| 5975 |
function useLessons(ids){ // the path shows these lessons only (null: every one)
|
| 5976 |
LESSONS=ALL_LESSONS.filter(l=>!ids||ids.includes(l.id)); if(!LESSONS.length) LESSONS=ALL_LESSONS;
|
| 5977 |
CATS=ALL_CATS.filter(c=>LESSONS.some(l=>l.id===c.lesson)); // none when every lesson of the student's is still to come
|
| 5978 |
-
|
|
|
|
| 5979 |
}
|
| 5980 |
const ready=fetch("/api/phrases").then(r=>r.json()).then(d=>{
|
| 5981 |
ALL_LEVELS=d.levels||[]; ALL_LESSONS=d.lessons; ALL_CATS=d.categories; GAMES=d.games||[]; PHRASES=d.phrases;
|
|
|
|
| 2867 |
box.checked=all; box.disabled=!todo.length;
|
| 2868 |
order=all?topic:todo; pos=0; marks();
|
| 2869 |
}
|
| 2870 |
+
function startCat(wait=true){ if(!CATS.length) return marks(); setRound(); if(order.length) show(null,bubbleCat()?false:wait); }
|
| 2871 |
// What tells how much was practised, redrawn when a score comes in: the path and the box's text. The count itself is in the list's title.
|
| 2872 |
function marks(){
|
| 2873 |
drawPath(); // with no topic yet, the path still shows what is to come
|
|
|
|
| 5975 |
function useLessons(ids){ // the path shows these lessons only (null: every one)
|
| 5976 |
LESSONS=ALL_LESSONS.filter(l=>!ids||ids.includes(l.id)); if(!LESSONS.length) LESSONS=ALL_LESSONS;
|
| 5977 |
CATS=ALL_CATS.filter(c=>LESSONS.some(l=>l.id===c.lesson)); // none when every lesson of the student's is still to come
|
| 5978 |
+
const said=c=>PHRASES.some(p=>p.cat===c.id&&p.listed!==false); // a topic with sentences to say: not new words, pairs or writing
|
| 5979 |
+
if(CATS.length&&!CATS.some(c=>c.id===cat&&said(c))) cat=(CATS.find(said)||CATS[0]).id; // e.g. the last topic was a game
|
| 5980 |
}
|
| 5981 |
const ready=fetch("/api/phrases").then(r=>r.json()).then(d=>{
|
| 5982 |
ALL_LEVELS=d.levels||[]; ALL_LESSONS=d.lessons; ALL_CATS=d.categories; GAMES=d.games||[]; PHRASES=d.phrases;
|