Refactor score filtering logic in exam scores user template for consistent layout

This commit is contained in:
Ross
2026-01-19 12:57:10 +00:00
parent 81e22dfc88
commit d3d3638c1c
@@ -112,12 +112,12 @@
$(document).ready(function () { $(document).ready(function () {
$("#hide-viewer").on('click', function(){ $('.viewer-block .viewer-body').toggle(); }); $("#hide-viewer").on('click', function(){ $('.viewer-block .viewer-body').toggle(); });
// Filter questions by score // Filter questions by score using Bootstrap's d-none for consistent layout
$("#filter-score").on('change', function(){ $("#filter-score").on('change', function(){
const val = $(this).val(); const val = $(this).val();
$(".list-group-item[data-score]").each(function(){ $(".list-group-item[data-score]").each(function(){
const s = $(this).data('score'); const s = $(this).data('score');
if(val === 'all' || String(s) === String(val)) $(this).show(); else $(this).hide(); if(val === 'all' || String(s) === String(val)) $(this).removeClass('d-none'); else $(this).addClass('d-none');
}); });
}); });
@@ -147,7 +147,7 @@
}); });
// auto-click first view button to populate viewer // auto-click first view button to populate viewer
const firstView = $(".view-question-button").first(); const firstView = $(".view-question-button:visible").first();
if(firstView.length){ firstView.click(); } if(firstView.length){ firstView.click(); }
}); });
</script> </script>