Skip to content

Commit

Permalink
fix(fix-163): fix tv_umur0 calculation
Browse files Browse the repository at this point in the history
  • Loading branch information
Jérôme GAVIGNET committed Nov 5, 2024
1 parent 3b26d04 commit 3f4ea18
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,8 @@ function tvMatch(row, key, matcher) {
if (!values.some((v) => v.toLowerCase().match(String(match_value)))) {
return false;
}
} else if (Number.isInteger(match_value) && ['≥', '≤'].some((char) => row[key].includes(char))) {
return eval(match_value + row[key].replace('≥', '>=').replace('≤', '<='));
} else if (!row[key].toLowerCase().match(String(match_value))) {
return false;
}
Expand Down Expand Up @@ -230,6 +232,10 @@ function tvMatchOptimized(row, key, matcher) {
return row_value.split('|').includes(match_value);
}

if (Number.isInteger(match_value) && ['≥', '≤'].some((char) => row[key].includes(char))) {
return eval(match_value + row[key].replace('≥', '>=').replace('≤', '<='));
}

return row_value.includes(match_value);
}

Expand Down
3 changes: 2 additions & 1 deletion test/corpus.json
Original file line number Diff line number Diff line change
Expand Up @@ -144,5 +144,6 @@
"2475E3702442Q",
"2492E1256472N",
"2494E3676842T",
"2376E3241961V"
"2376E3241961V",
"2463E3164679Z"
]
8 changes: 8 additions & 0 deletions test/fixtures/2463E3164679Z.xml

Large diffs are not rendered by default.

0 comments on commit 3f4ea18

Please sign in to comment.