Add feature to not match regexp
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
nemunaire 2022-03-04 11:21:21 +01:00
parent 9a19f3a945
commit 8d8ca15252

View File

@ -32,7 +32,7 @@
let filteredResponses = []; let filteredResponses = [];
$:{ $:{
filteredResponses = responses.filter((r) => (notCorrected || !r.time_scored) && (!filter || r.value.match(filter))); filteredResponses = responses.filter((r) => (notCorrected || !r.time_scored) && (!filter || ((filter[0] == '!' && !r.value.match(filter.substring(1))) || r.value.match(filter))));
} }
export async function applyCorrections() { export async function applyCorrections() {
@ -42,7 +42,7 @@
for (const tpl of templates) { for (const tpl of templates) {
if (!tpl.regexp && tpl.label) continue; if (!tpl.regexp && tpl.label) continue;
if (tpl.regexp && r.value.match(tpl.regexp)) { if (tpl.regexp && (tpl.regexp[0] == '!' && !r.value.match(tpl.regexp.substring(1))) || r.value.match(tpl.regexp)) {
my_correction[tpl.id] = true; my_correction[tpl.id] = true;
} else { } else {
my_correction[tpl.id] = false; my_correction[tpl.id] = false;