(2-28) 찾는 자막이 없어도 0이 리턴되어 정답처리되는 상황 처리

This commit is contained in:
2025-03-31 17:17:05 +09:00
parent e3ea5c546d
commit b842db795d
14 changed files with 20 additions and 12 deletions

View File

@@ -12,9 +12,10 @@ const getToday = require('./getToday.js');
const todayDate = getToday();
// --------------------------------------------------------
const scoringJson = require('./DIC_2503A.json');
// const scoringJson = require('./DIC_2503A.json');
// const scoringJson = require('./DIC_2503B.json');
// const scoringJson = require('./DIC_2503C.json');
const scoringJson = require('./DIC_2503C.json');
const { get } = require('http');
// const scoringJson = require('./DIC_2503D.json');
// TEST
@@ -23,7 +24,7 @@ const scoringJson = require('./DIC_2503A.json');
// const scoringJson = require('./DIC_2503C_TEST.json');
// const scoringJson = require('./DIC_2503D_TEST.json');
// --------------------------------------------------------
const answerFilesDir = './output/A/DIC';
// const answerFilesDir = './output/A/DIC';
// const answerFilesDir = './output/B/DIC';
// const answerFilesDir = './output/C/DIC';
// const answerFilesDir = './output/D/DIC';
@@ -31,19 +32,19 @@ const answerFilesDir = './output/A/DIC';
// 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';
// --------------------------------------------------------
const outputExcelFile = './'+todayDate+'_DIC_2503A_채점결과.xlsx';
// const outputExcelFile = './'+todayDate+'_DIC_2503A_채점결과.xlsx';
// const outputExcelFile = './'+todayDate+'_DIC_2503B_채점결과.xlsx';
// const outputExcelFile = './'+todayDate+'_DIC_2503C_채점결과.xlsx';
// const outputExcelFile = './' + todayDate + '_DIC_2503C_채점결과.xlsx';
// const outputExcelFile = './'+todayDate+'_DIC_2503D_채점결과.xlsx';
// TEST
// const outputExcelFile = './'+todayDate+'_DIC_2503A_TEST.xlsx';
// const outputExcelFile = './' + todayDate + '_DIC_2503B_TEST.xlsx';
// const outputExcelFile = './'+todayDate+'_DIC_2503C_TEST.xlsx';
// const outputExcelFile = './'+todayDate+'_DIC_2503B_TEST.xlsx';
const outputExcelFile = './'+todayDate+'_DIC_2503C_TEST.xlsx';
// const outputExcelFile = './'+todayDate+'_DIC_2503D_TEST.xlsx';
// --------------------------------------------------------
@@ -166,7 +167,7 @@ function getTrackClipNode(xmlDoc, type, videoStartTime, openingStartTime) {
let trackClipNode = null;
// 동영상 자막이면 2, 오프닝 자막이면 1, 그 외는 0
const subtitleOrder = type === 'video' ? 2 : type === 'opening' ? 1 : 0;
const subtitleOrder = type === 'video' ? 2 : type === 'opening' ? 1 : null;
const startTime = type === 'video' ? videoStartTime : openingStartTime;
// xpath 구문을 통해 CRTrackClip 요소의 ClipIndex를 찾음
@@ -475,6 +476,13 @@ function getGmepScore(gmepData, scoringJson, index) {
// 문제의 타입이 video(동영상자막) 또는 opening(오프닝자막)일 경우
else if (type == "video" || type == "opening") {
const trackClipNode = getTrackClipNode(gmepXmlDoc, type, videoStartTime, openingStartTime);
// 찾으려는 자막이 존재하지 않는 경우
// (2-28) 문항의 경우 오프닝 자막이 없어도 xpath구문의 sum함수 결과값이 0이 반환되는것을 방지
if ( trackClipNode === undefined ) {
scoringResult[key] = 0;
continue;
}
const result = ele ? xpath.select(ele, gmepXmlDoc) : [];
const result2 = ele2 ? xpath.select(ele2, gmepXmlDoc) : [];
const result3 = ele3 ? xpath.select(ele3, gmepXmlDoc) : [];
@@ -546,7 +554,7 @@ function getGmepScore(gmepData, scoringJson, index) {
scoringResult[key] = 0;
}
}
else if (type == "videoIsExist") {
else if (type == "videoIsExist") {
const result = ele ? xpath.select(ele, gmepXmlDoc) : [];
const result2 = ele2 ? xpath.select(ele2, gmepXmlDoc) : [];
const allResults = [...[result], ...[result2]];
@@ -557,7 +565,7 @@ function getGmepScore(gmepData, scoringJson, index) {
totalScore += point;
scoringResult[key] = point;
console.log(`🚀 ~ result.forEach ~ 정답:${rightAnswer} / 작성답안:${allResults}`);
}
}
else {
scoringResult[key] = 0;
console.log("🚀 ~ result.forEach ~ 오답:", rightAnswer)