(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

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

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)

View File

@@ -1 +1 @@
[{"kind":2,"language":"xpath","value":"//Layer/Name/@value = 'Germs'"},{"kind":2,"language":"xpath","value":"//Layer[Name[@value='Germs']]/Effects/Item[Name[@value='선명하게'] and EffectData[amount[@value=\"12\"]]]"},{"kind":2,"language":"xpath","value":"//Layer[Name[@value='Germs']]/Effects/Item/(Name/@value | EffectData/amount/@value)"},{"kind":2,"language":"xpath","value":"//CRCUnitArr[@Name='{search}']//GCUnitPool/GCUnit[@Type='2']/@*[name()='VID100' or name()='VID101']"},{"kind":2,"language":"xpath","value":"//Layer//op_points[Item]/Item[last()]/X/@value"},{"kind":2,"language":"xpath","value":"//Layer//op_points[Item]/Item[1]/X/@value"},{"kind":2,"language":"xpath","value":"//Layer//Shape[contains(draw_type/@value, 'Interior')]/secondary_color/@value"},{"kind":2,"language":"xpath","value":"//Layer//Shape[contains(draw_type/@value, 'Interior')]/secondary_color/@value"},{"kind":2,"language":"xpath","value":"//Layer/BlendOp/@value | //Layer/Opacity/@value"},{"kind":2,"language":"xpath","value":"//CRTransFilter[@ClipIndex=count(//CRTrackList[@Name='비디오1']/CRTrackClip[@ClipIndex=count(//CRClip[@Path='이미지3.jpg']/preceding-sibling::CRClip | //CRClip[@Type='11']/CRCUnitArr[@Path='이미지3.jpg']/../preceding-sibling::CRClip)][1]/preceding-sibling::CRTrackClip)]/@*[name()='ID' or name()='Range' or name()='Type']"},{"kind":2,"language":"xpath","value":"//CRTransFilter[@ClipIndex=count(//CRTrackList[@Name='비디오1']/CRTrackClip[@ClipIndex=count(//CRClip[@Path='이미지1.jpg']/preceding-sibling::CRClip | //CRClip[@Type='11']/CRCUnitArr[@Path='이미지1.jpg']/../preceding-sibling::CRClip)][1]/preceding-sibling::CRTrackClip)]/@*[name()='ID' or name()='Range' or name()='Type']"},{"kind":2,"language":"xpath","value":"//CRTransFilter[@ClipIndex=count(//CRTrackList[@Name='비디오1']/CRTrackClip[@ClipIndex=count(//CRClip[@Path='이미지3.jpg']/preceding-sibling::CRClip)])]/@*[name()='ID' or name()='Range' or name()='Type']"}]
[{"kind":2,"language":"xpath","value":"//Layer/Name/@value = 'Germs'"},{"kind":2,"language":"xpath","value":"//Layer[Name[@value='Germs']]/Effects/Item[Name[@value='선명하게'] and EffectData[amount[@value=\"12\"]]]"},{"kind":2,"language":"xpath","value":"//Layer[Name[@value='Germs']]/Effects/Item/(Name/@value | EffectData/amount/@value)"},{"kind":2,"language":"xpath","value":"//CRCUnitArr[@Name='{search}']//GCUnitPool/GCUnit[@Type='2']/@*[name()='VID100' or name()='VID101']"},{"kind":2,"language":"xpath","value":"//Layer//op_points[Item]/Item[last()]/X/@value"},{"kind":2,"language":"xpath","value":"//Layer//op_points[Item]/Item[1]/X/@value"},{"kind":2,"language":"xpath","value":"//Layer//Shape[contains(draw_type/@value, 'Interior')]/secondary_color/@value"},{"kind":2,"language":"xpath","value":"//Layer//Shape[contains(draw_type/@value, 'Interior')]/secondary_color/@value"},{"kind":2,"language":"xpath","value":"//Layer/BlendOp/@value | //Layer/Opacity/@value"},{"kind":2,"language":"xpath","value":"//CRTransFilter[@ClipIndex=count(//CRTrackList[@Name='비디오1']/CRTrackClip[@ClipIndex=count(//CRClip[@Path='이미지3.jpg']/preceding-sibling::CRClip | //CRClip[@Type='11']/CRCUnitArr[@Path='이미지3.jpg']/../preceding-sibling::CRClip)][1]/preceding-sibling::CRTrackClip)]/@*[name()='ID' or name()='Range' or name()='Type']"},{"kind":2,"language":"xpath","value":"//CRTransFilter[@ClipIndex=count(//CRTrackList[@Name='비디오1']/CRTrackClip[@ClipIndex=count(//CRClip[@Path='이미지1.jpg']/preceding-sibling::CRClip | //CRClip[@Type='11']/CRCUnitArr[@Path='이미지1.jpg']/../preceding-sibling::CRClip)][1]/preceding-sibling::CRTrackClip)]/@*[name()='ID' or name()='Range' or name()='Type']"},{"kind":2,"language":"xpath","value":"//CRTransFilter[@ClipIndex=count(//CRTrackList[@Name='비디오1']/CRTrackClip[@ClipIndex=count(//CRClip[@Path='이미지3.jpg']/preceding-sibling::CRClip)])]/@*[name()='ID' or name()='Range' or name()='Type']"},{"kind":2,"language":"xpath","value":"sum(//CRCUnitArr[1] and //CRTrackList[@Name='텍스트']/CRTrackClip[not(@ClipIndex='-1')][1]/preceding-sibling::CRTrackClip/@Length)"},{"kind":2,"language":"xpath","value":"sum(//CRCUnitArr[2] and //CRTrackList[@Name='텍스트']/CRTrackClip[not(@ClipIndex='-1')][2]/preceding-sibling::CRTrackClip/@Length)\r\n"}]