Index: openacs-4/packages/xowf/www/resources/inclass-exam.js =================================================================== RCS file: /usr/local/cvsroot/openacs-4/packages/xowf/www/resources/inclass-exam.js,v diff -u -r1.1.2.3 -r1.1.2.4 --- openacs-4/packages/xowf/www/resources/inclass-exam.js 23 Apr 2024 11:06:28 -0000 1.1.2.3 +++ openacs-4/packages/xowf/www/resources/inclass-exam.js 26 Jul 2024 11:24:22 -0000 1.1.2.4 @@ -1,16 +1,21 @@ -function traverseQuestions (callback) { - for (const question of document.querySelectorAll('.test-item')) { +function traverseQuestions (callback, root = document) { + for (const question of root.querySelectorAll('.test-item')) { callback(question); } } function filterNotGraded () { const checked = document.querySelector('#search-not-graded').checked; - traverseQuestions(function (question) { - const grade = question.querySelector('.grading-box > .points'); - const isGraded = grade && grade.textContent !== ''; - question.style.display = checked && isGraded ? 'none' : 'block'; - }); + for (const exam of document.querySelectorAll('.single_exam')) { + let examGraded = true; + traverseQuestions(function (question) { + const grade = question.querySelector('.grading-box > .points'); + const isGraded = grade && grade.textContent !== ''; + examGraded &= isGraded; + question.style.display = checked && isGraded ? 'none' : 'block'; + }); + exam.style.display = checked && examGraded ? 'none' : 'block'; + } } function handleSearch () {