change runtimeCheckLog
This commit is contained in:
		
							parent
							
								
									0ebebdd7f0
								
							
						
					
					
						commit
						3e7b60839e
					
				| 
						 | 
					@ -103,7 +103,8 @@ export async function runtimeCheckLogs(folderPath) {
 | 
				
			||||||
          const filePath = path
 | 
					          const filePath = path
 | 
				
			||||||
          let lines = [];
 | 
					          let lines = [];
 | 
				
			||||||
          const today = DateTime.now().toFormat('yyyy-MM-dd');
 | 
					          const today = DateTime.now().toFormat('yyyy-MM-dd');
 | 
				
			||||||
          let allFile = await LogDetectFile.all();
 | 
					          let allFile = await LogDetectFile.query()
 | 
				
			||||||
 | 
					          .whereRaw(`DATE(created_at) = ?`, [today])
 | 
				
			||||||
          // let allReport = await LogReport.all();
 | 
					          // let allReport = await LogReport.all();
 | 
				
			||||||
          let allValue = await KeyValue.all();
 | 
					          let allValue = await KeyValue.all();
 | 
				
			||||||
          const allReport = await LogReport.query()
 | 
					          const allReport = await LogReport.query()
 | 
				
			||||||
| 
						 | 
					@ -153,40 +154,40 @@ export async function runtimeCheckLogs(folderPath) {
 | 
				
			||||||
            .map((obj) => obj.$original.value);
 | 
					            .map((obj) => obj.$original.value);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          //Process file content
 | 
					          //Process file content
 | 
				
			||||||
          // contentFile.map((line, index) => {
 | 
					          contentFile.map((line, index) => {
 | 
				
			||||||
          //   //check line the line with errors and exclude errors
 | 
					            //check line the line with errors and exclude errors
 | 
				
			||||||
          //   listKeyValues
 | 
					            listKeyValues
 | 
				
			||||||
          //     .map((obj) => obj.$original.value)
 | 
					              .map((obj) => obj.$original.value)
 | 
				
			||||||
          //     .map(async (value) => {
 | 
					              .map(async (value) => {
 | 
				
			||||||
          //       if (
 | 
					                if (
 | 
				
			||||||
          //         line.search(value) !== -1 &&
 | 
					                  line.search(value) !== -1 &&
 | 
				
			||||||
          //         listExcludeErr.filter((err) => line.includes(err))
 | 
					                  listExcludeErr.filter((err) => line.includes(err))
 | 
				
			||||||
          //           .length === 0
 | 
					                    .length === 0
 | 
				
			||||||
          //       ) {
 | 
					                ) {
 | 
				
			||||||
          //         let log = allFile?.filter(
 | 
					                  let log = allFile?.filter(
 | 
				
			||||||
          //           (i) => i.$original.file_name === fileName
 | 
					                    (i) => i.$original.file_name === fileName
 | 
				
			||||||
          //         )[0];
 | 
					                  )[0];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          //         let checkLog = allReport?.filter(
 | 
					                  let checkLog = allReport?.filter(
 | 
				
			||||||
          //           (report) =>
 | 
					                    (report) =>
 | 
				
			||||||
          //             report.$original.id_file === log?.id_ldf &&
 | 
					                      report.$original.id_file === log?.id_ldf &&
 | 
				
			||||||
          //             report.$original.line === index + 1 &&
 | 
					                      report.$original.line === index + 1 &&
 | 
				
			||||||
          //             report.$original.detected_content === value
 | 
					                      report.$original.detected_content === value
 | 
				
			||||||
          //         );
 | 
					                  );
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          //         if (checkLog?.length === 0) {
 | 
					                  if (checkLog?.length === 0) {
 | 
				
			||||||
          //           // await LogReport.create({
 | 
					                    // await LogReport.create({
 | 
				
			||||||
          //           //   detected_content: value,
 | 
					                    //   detected_content: value,
 | 
				
			||||||
          //           //   line: index + 1,
 | 
					                    //   line: index + 1,
 | 
				
			||||||
          //           //   id_file: log?.id_ldf,
 | 
					                    //   id_file: log?.id_ldf,
 | 
				
			||||||
          //           // });
 | 
					                    // });
 | 
				
			||||||
          //           lines.push(index + 1);
 | 
					                    lines.push(index + 1);
 | 
				
			||||||
          //         }
 | 
					                  }
 | 
				
			||||||
          //       }
 | 
					                }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          //       // if(checkSpecialVersion())
 | 
					                // if(checkSpecialVersion())
 | 
				
			||||||
          //     });
 | 
					              });
 | 
				
			||||||
          // });
 | 
					          });
 | 
				
			||||||
 | 
					
 | 
				
			||||||
          //true: import log to log_report table, send report to Zulip
 | 
					          //true: import log to log_report table, send report to Zulip
 | 
				
			||||||
          // setTimeout(async () => {
 | 
					          // setTimeout(async () => {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in New Issue