From 783ed9684bda3061886290c20132e03305963778 Mon Sep 17 00:00:00 2001 From: joseph le Date: Wed, 29 Nov 2023 08:43:51 +0700 Subject: [PATCH] update highlight --- app/Controllers/Http/LogsController.ts | 34 ++++++++++++++++++++++++-- 1 file changed, 32 insertions(+), 2 deletions(-) diff --git a/app/Controllers/Http/LogsController.ts b/app/Controllers/Http/LogsController.ts index 3679852..8ecb0bc 100644 --- a/app/Controllers/Http/LogsController.ts +++ b/app/Controllers/Http/LogsController.ts @@ -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]);