2502회 채점결과 / xpath내부 "(큰따옴표)필터링 / gmdp 확장자 처리

This commit is contained in:
2025-02-27 18:11:34 +09:00
parent ce11e9f508
commit c2f5955342
23 changed files with 55 additions and 48 deletions

View File

@@ -12,9 +12,9 @@ const todayDate = getToday();
// --------------------------------------------------------
// const scoringJson = require('./DIC_2502A.json');
// const scoringJson = require('./DIC_2502B.json');
const scoringJson = require('./DIC_2502B.json');
// const scoringJson = require('./DIC_2502C.json');
const scoringJson = require('./DIC_2502D.json');
// const scoringJson = require('./DIC_2502D.json');
// TEST
// const scoringJson = require('./DIC_2502A_TEST.json');
@@ -23,9 +23,9 @@ const scoringJson = require('./DIC_2502D.json');
// const scoringJson = require('./DIC_2502D_TEST.json');
// --------------------------------------------------------
// const answerFilesDir = './output/A/DIC';
// const answerFilesDir = './output/B/DIC';
const answerFilesDir = './output/B/DIC';
// const answerFilesDir = './output/C/DIC';
const answerFilesDir = './output/D/DIC';
// const answerFilesDir = './output/D/DIC';
// TEST
// const answerFilesDir = './output/A/TEST';
@@ -35,7 +35,7 @@ const answerFilesDir = './output/D/DIC';
// --------------------------------------------------------
// const outputExcelFile = './'+todayDate+'_DIC_2502A_result.xlsx';
// const outputExcelFile = './'+todayDate+'_DIC_2502B_result.xlsx';
const outputExcelFile = './'+todayDate+'_DIC_2502B_result.xlsx';
// const outputExcelFile = './'+todayDate+'_DIC_2502C_result.xlsx';
// const outputExcelFile = './'+todayDate+'_DIC_2502D_result.xlsx';
@@ -43,7 +43,7 @@ const answerFilesDir = './output/D/DIC';
// const outputExcelFile = './'+todayDate+'_DIC_2502A_TEST.xlsx';
// const outputExcelFile = './'+todayDate+'_DIC_2502B_TEST.xlsx';
// const outputExcelFile = './'+todayDate+'_DIC_2502C_TEST.xlsx';
const outputExcelFile = './'+todayDate+'_DIC_2502D_TEST.xlsx';
// const outputExcelFile = './'+todayDate+'_DIC_2502D_TEST.xlsx';
// --------------------------------------------------------
// 답안 폴더 내부에 디렉토리가 아닌 일반 파일이 있을 경우 디렉토리만 필터링 해서 불러옴
@@ -62,7 +62,12 @@ studentDirs.forEach(student => {
const name = student.normalize('NFC');
const studentDir = path.join(answerFilesDir, student);
const psdFiles = fs.readdirSync(studentDir).filter(file => file.endsWith('.psd'));
const gmepFile = fs.readdirSync(studentDir).filter(file => file.endsWith('.gmep'));
// DIAT시험 프로젝트로 생성시 gmep확장자로
// 교육용 프로젝프로 생성시 gmdp확장자로 생성됨
// 두 경우 모두 처리
const gmepFile = fs.readdirSync(studentDir).filter(
file => file.endsWith('.gmep') || file.endsWith('.gmdp')
);
// 학생 이름을 key로 하는 객체 생성
// 채점결과
@@ -160,6 +165,10 @@ function getGmepScore(gmepData, scoringJson, index) {
*/
if (search !== undefined) {
let result = findSimilarString(gmepXmlDoc, search, 0.8)
// xpath 내부 "(큰따옴표) 필터링
if (result !== null) {
result = result.replace(/"/g, "'");
}
ele = ele.replace(/{search}/g, result);
if ( existEle !== undefined ){
existEle = existEle.replace(/{search}/g, result);