Refactor exam search widget: streamline filtering logic and enhance queryset efficiency

This commit is contained in:
Ross
2026-02-16 13:49:17 +00:00
parent 6e30fcc19f
commit c61f92ae9e
2 changed files with 22 additions and 33 deletions
-11
View File
@@ -564,17 +564,6 @@ class ExamSearchSelectMultipleWidget:
return {{ cleaned: cleaned, filters: filters }};
}}
function parseFilterTokens(q) {{
const filters = {{}};
if (!q) return {{ cleaned: '', filters: filters }};
let cleaned = q.replace(tokenRe, function(m, name, val) {{
filters[name] = /^(1|true|yes)$/i.test(val);
return ' ';
}});
cleaned = cleaned.replace(/\s+/g,' ').trim();
return {{ cleaned: cleaned, filters: filters }};
}}
function fetchResults(rawQ) {{
const parsed = parseFilterTokens(rawQ || '');
const q = parsed.cleaned;