Limit practice sessions to the assigned list only
Remove cross-list review words (Leitner spaced repetition) from practice sessions so only the currently assigned list's words are shown. Also remove the now-unused dueReviews count from the state endpoint and student UI. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
43aa367f63
commit
4574bd3785
2 files changed
+3
-22
No files matched your search
@@ -902,9 +902,6 @@ function renderSpellingTab(state, tests = []) {
|
|||||||
html = `No list assigned yet — ask a parent to pick one!`;
|
html = `No list assigned yet — ask a parent to pick one!`;
|
||||||
currentSpellingListId = null;
|
currentSpellingListId = null;
|
||||||
}
|
}
|
||||||
if (state.dueReviews > 0) {
|
|
||||||
html += `<div>🔁 ${state.dueReviews} old ${state.dueReviews === 1 ? 'word' : 'words'} due for review</div>`;
|
|
||||||
}
|
|
||||||
$('#kid-week').innerHTML = html;
|
$('#kid-week').innerHTML = html;
|
||||||
$('#btn-test').disabled = !state.assignment;
|
$('#btn-test').disabled = !state.assignment;
|
||||||
$('#btn-print-list').disabled = !state.assignment;
|
$('#btn-print-list').disabled = !state.assignment;
|
||||||
|
|||||||
@@ -413,17 +413,10 @@ app.get('/api/state/:studentId', (req, res) => {
|
|||||||
`).get(id, assignment.id);
|
`).get(id, assignment.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
// only words outside this week's list count as "old reviews"
|
res.json({ student: { ...student, isBirthdayWeek: isBirthdayWeek(student.birthday) }, assignment, listProgress });
|
||||||
const dueReviews = db.prepare(`
|
|
||||||
SELECT COUNT(*) AS n FROM progress p JOIN words w ON w.id = p.word_id
|
|
||||||
WHERE p.student_id = ? AND w.list_id <> ? AND p.box < ${MASTERED_BOX}
|
|
||||||
AND date(p.due) <= date('now')
|
|
||||||
`).get(id, assignment ? assignment.id : -1).n;
|
|
||||||
|
|
||||||
res.json({ student: { ...student, isBirthdayWeek: isBirthdayWeek(student.birthday) }, assignment, listProgress, dueReviews });
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Build a practice session: the target list's unmastered words + due reviews.
|
// Build a practice session: the target list's unmastered words only.
|
||||||
// listId overrides the student's pinned weekly assignment (used when launched from a course item).
|
// listId overrides the student's pinned weekly assignment (used when launched from a course item).
|
||||||
app.get('/api/session/:studentId', (req, res) => {
|
app.get('/api/session/:studentId', (req, res) => {
|
||||||
const id = req.params.studentId;
|
const id = req.params.studentId;
|
||||||
@@ -441,16 +434,7 @@ app.get('/api/session/:studentId', (req, res) => {
|
|||||||
ORDER BY box, RANDOM()
|
ORDER BY box, RANDOM()
|
||||||
`).all(id, listId);
|
`).all(id, listId);
|
||||||
|
|
||||||
const reviews = db.prepare(`
|
res.json({ words: shuffle(weekWords) });
|
||||||
SELECT w.id, w.word, w.sentence, w.definition, p.box
|
|
||||||
FROM progress p JOIN words w ON w.id = p.word_id
|
|
||||||
WHERE p.student_id = ? AND w.list_id <> ? AND p.box < ${MASTERED_BOX}
|
|
||||||
AND date(p.due) <= date('now')
|
|
||||||
ORDER BY p.due
|
|
||||||
LIMIT 5
|
|
||||||
`).all(id, listId);
|
|
||||||
|
|
||||||
res.json({ words: shuffle([...weekWords, ...reviews]) });
|
|
||||||
});
|
});
|
||||||
|
|
||||||
// Grade one practice answer. firstTry attempts move the Leitner box;
|
// Grade one practice answer. firstTry attempts move the Leitner box;
|
||||||
|
|||||||
Reference in new issue
Block a user