update highlight

This commit is contained in:
joseph le 2023-11-29 08:43:51 +07:00
parent 43e8299bf1
commit 783ed9684b
1 changed files with 32 additions and 2 deletions

View File

@ -8,7 +8,37 @@ export default class LogsController {
public async showLog({request, response}: HttpContextContract) {
try {
// fghf
console.log(request.params().name);
const checkSpecialVersion = (paragraph) => {
try {
const regex = /\(CAT[1-9]K.*Version 16\.9\.[2-9]/;
const regex1 =
/\(CAT[1-9]K.*Version 1[7-9]\.[0-9]\.[0-9]/;
const regex2 =
/\(CAT[1-9]K.*Version [2-9][0-9]\.[0-9]\.[0-9]/;
// Use the regular expression to find the match
const match = paragraph.match(regex);
const match1 = paragraph.match(regex1);
const match2 = paragraph.match(regex2);
if (match || match1 || match2) {
if (match) {
return match[0];
}
if (match1) {
return match1[0];
}
if (match2) {
return match2[0];
}
} else {
return "";
}
} catch (error) {
console.log(error);
}
};
let fileDetect = await LogDetectFile.findBy(
"file_name",
request.params().name
@ -71,7 +101,7 @@ export default class LogsController {
if (
listExcludeErr.filter((err) => data[u - 1].includes(err)).length === 0
) {
if (MODEL_SPECIAL.filter((i) => data[u - 1].includes(i)).length > 0) {
if (MODEL_SPECIAL.filter((i) => data[u - 1].includes(i)).length > 0 || checkSpecialVersion(data[u-1])!=="") {
modelSpecialDetected.push(data[u - 1]);
} else {
issueSpecialDetected.push(data[u - 1]);