Merge branch 'main' of https://repo.teamsf.co.kr/g-zero/DIC
This commit is contained in:
@@ -7,14 +7,16 @@ const xpath = require('xpath');
|
||||
const { DOMParser } = require('xmldom');
|
||||
|
||||
const findSimilarString = require('./findSimilarString');
|
||||
const getGpdpScore = require('./gpdpScoring.js');
|
||||
const getToday = require('./getToday.js');
|
||||
const todayDate = getToday();
|
||||
|
||||
// --------------------------------------------------------
|
||||
// const scoringJson = require('./DIC_2502A.json');
|
||||
// const scoringJson = require('./DIC_2502B.json');
|
||||
const scoringJson = require('./DIC_2502C.json');
|
||||
// const scoringJson = require('./DIC_2502C.json');
|
||||
// const scoringJson = require('./DIC_2502D.json');
|
||||
const scoringJson = require('./samples/DIC(gompic).json');
|
||||
|
||||
// TEST
|
||||
// const scoringJson = require('./DIC_2502A_TEST.json');
|
||||
@@ -26,11 +28,11 @@ const scoringJson = require('./DIC_2502C.json');
|
||||
// const answerFilesDir = './output/B/DIC';
|
||||
// const answerFilesDir = './output/C/DIC';
|
||||
// const answerFilesDir = './output/D/DIC';
|
||||
|
||||
const answerFilesDir = './samples/';
|
||||
// TEST
|
||||
// const answerFilesDir = './output/A/TEST';
|
||||
// const answerFilesDir = './output/B/TEST';
|
||||
const answerFilesDir = './output/C/TEST';
|
||||
// const answerFilesDir = './output/C/TEST';
|
||||
// const answerFilesDir = './output/D/TEST';
|
||||
|
||||
// --------------------------------------------------------
|
||||
@@ -42,10 +44,12 @@ const answerFilesDir = './output/C/TEST';
|
||||
// TEST
|
||||
// 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_2502C_TEST.xlsx';
|
||||
// const outputExcelFile = './'+todayDate+'_DIC_2502D_TEST.xlsx';
|
||||
const outputExcelFile = './'+todayDate+'_gompic.xlsx';
|
||||
// --------------------------------------------------------
|
||||
|
||||
|
||||
// 답안 폴더 내부에 디렉토리가 아닌 일반 파일이 있을 경우 디렉토리만 필터링 해서 불러옴
|
||||
const studentDirs = fs.readdirSync(answerFilesDir).filter(file => {
|
||||
const filePath = path.join(answerFilesDir, file);
|
||||
@@ -68,6 +72,11 @@ studentDirs.forEach(student => {
|
||||
file => file.endsWith('.gmep') || file.endsWith('.gmdp')
|
||||
);
|
||||
|
||||
// 곰픽 파일 gpdp 파일 이거나 xml 파일
|
||||
const gpdpFile = fs.readdirSync(studentDir).filter(
|
||||
file => file.endsWith('.xml')
|
||||
);
|
||||
|
||||
// 학생 이름을 key로 하는 객체 생성
|
||||
// 채점결과
|
||||
const scoringResult = {
|
||||
@@ -86,6 +95,17 @@ studentDirs.forEach(student => {
|
||||
console.error(`Error reading PSD file: ${psdPath}`, error);
|
||||
}
|
||||
});
|
||||
gpdpFile.forEach((gpdp, index) => {
|
||||
const gpdpPath = path.join('./', studentDir, gpdp);
|
||||
console.log(`Reading ${gpdpPath}...`);
|
||||
|
||||
const xmlString = fs.readFileSync(gpdpPath, 'utf8');
|
||||
// XML 문자열을 파싱하여 XML 문서 객체로 변환
|
||||
const xmlDocument = new DOMParser().parseFromString(xmlString, 'application/xml');
|
||||
// console.log('xmlDocument:', xmlDocument);
|
||||
|
||||
scoringResult[index + 1] = getGpdpScore(xmlDocument, scoringJson, index + 3);
|
||||
});
|
||||
gmepFile.forEach((gmep, index) => {
|
||||
const gmepPath = path.join('./', studentDir, gmep);
|
||||
console.log(`Reading ${gmepPath}...`);
|
||||
|
||||
Reference in New Issue
Block a user