곰픽 JSON 채점기준표, 소스코드 수정

This commit is contained in:
2025-04-15 17:44:45 +09:00
parent 547cd05a8b
commit d03361bebf
7 changed files with 62 additions and 53 deletions

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -662,7 +662,7 @@
"19": { "19": {
"type": "color", "type": "color",
"ele": "//Layer//Shape[contains(draw_type/@value, 'Outline')]/primary_color/@value", "ele": "//Layer//Shape[contains(draw_type/@value, 'Outline')]/primary_color/@value",
"value": "40EEAB", "value": "40eeab",
"point": 3, "point": 3,
"desc": "색상 코드 비교 시 소문자로 입력할 것(채우기:secondary_color, 외곽선:primary_color)" "desc": "색상 코드 비교 시 소문자로 입력할 것(채우기:secondary_color, 외곽선:primary_color)"
}, },
@@ -676,8 +676,8 @@
"angle": "//Layer//Shape[contains(draw_type/@value, 'Shadow')]/shadow_angle/@value" "angle": "//Layer//Shape[contains(draw_type/@value, 'Shadow')]/shadow_angle/@value"
}, },
"value": { "value": {
"width": "5", "width": "7",
"distance": "3", "distance": "5",
"blur": "1", "blur": "1",
"angle": "320" "angle": "320"
}, },

View File

@@ -452,14 +452,14 @@
"desc": "자유 변형 문항은 채점 불가" "desc": "자유 변형 문항은 채점 불가"
}, },
"3": { "3": {
"type" : "isExist", "type" : "exists",
"ele": "//Layer/Name/@value", "ele": "//Layer/Name/@value",
"value": "Leaf", "value": "Leaf",
"point": 5, "point": 5,
"desc": "Leaf 레이어가 있는지 여부 체크" "desc": "Leaf 레이어가 있는지 여부 체크"
}, },
"4": { "4": {
"type" : "multiValue", "type" : "effects",
"ele": "//Layer[Name[@value='{layer}']]/Effects/Item", "ele": "//Layer[Name[@value='{layer}']]/Effects/Item",
"layer" : "Leaf", "layer" : "Leaf",
"option" : "Lift", "option" : "Lift",
@@ -476,7 +476,7 @@
"desc": "올가미 도구/이미지 문항은 채점 불가" "desc": "올가미 도구/이미지 문항은 채점 불가"
}, },
"6": { "6": {
"type" : "isExist", "type" : "exists",
"ele": "//Layer/Effects/Item/Name/@value", "ele": "//Layer/Effects/Item/Name/@value",
"value" : "세피아", "value" : "세피아",
"point": 6, "point": 6,
@@ -491,11 +491,10 @@
}, },
"8": { "8": {
"type": "size", "type": "size",
"posX": "//Layer//op_points[Item]/Item[last()]/X/@value - //Layer//op_points[Item]/Item[1]/X/@value", "ele": "//Layer//op_points",
"posY": "//Layer//op_points[Item]/Item[last()]/Y/@value - //Layer//op_points[Item]/Item[1]/Y/@value",
"value": { "value": {
"width": 650, "width": 650,
"height": 80 "height": 50
}, },
"point": 3, "point": 3,
"desc": "레이어 쉐이프 X, Y 좌표를 가지고 너비, 높이 계산하여 정답 채점" "desc": "레이어 쉐이프 X, Y 좌표를 가지고 너비, 높이 계산하여 정답 채점"
@@ -545,7 +544,9 @@
"desc": "배경색 문항은 채점 불가" "desc": "배경색 문항은 채점 불가"
}, },
"3": { "3": {
"ele": "//Layer[contains(Name/@value, 'Layer 2')][MaskOpType/@value='Layering']", "type": "exists",
"ele": "//Layer/MaskOpType/@value",
"value": "Layering",
"point": 6 "point": 6
}, },
"4": { "4": {
@@ -554,14 +555,14 @@
"desc": "가로방향 흐릿하게 문항은 채점 불가" "desc": "가로방향 흐릿하게 문항은 채점 불가"
}, },
"5": { "5": {
"ele": "//Layer[contains(Name/@value, 'Layer 3')]//shape_type/@value", "type": "exists",
"answer": "RECTANGLE", "ele": "//Layer//shape_type/@value",
"value": "ELLIPSE",
"point": 3 "point": 3
}, },
"6": { "6": {
"type": "size", "type": "size",
"posX": "//Layer[contains(Name/@value, 'Layer 3')]//op_points[Item]/Item[last()]/X/@value - //Layer[contains(Name/@value, 'Layer 3')]//op_points[Item]/Item[1]/X/@value", "ele": "//Layer//op_points",
"posY": "//Layer[contains(Name/@value, 'Layer 3')]//op_points[Item]/Item[last()]/Y/@value - //Layer[contains(Name/@value, 'Layer 3')]//op_points[Item]/Item[1]/Y/@value",
"value": { "value": {
"width": 450, "width": 450,
"height": 85 "height": 85
@@ -571,8 +572,9 @@
}, },
"7": { "7": {
"type": "gradient", "type": "gradient",
"startColor": "//Layer[contains(Name/@value, 'Layer 3')]//gradient_start_color/@value", "ele": "//Layer/Shapes/Shape",
"endColor": "//Layer[contains(Name/@value, 'Layer 3')]//gradient_end_color/@value", "startColor": "gradient_start_color/@value",
"endColor": "gradient_end_color/@value",
"value": { "value": {
"startColor": "ffe000", "startColor": "ffe000",
"endColor": "995555" "endColor": "995555"
@@ -580,25 +582,26 @@
"point": 6 "point": 6
}, },
"8": { "8": {
"type": "exact", "type": "exists",
"ele": "//Layer//Shape[shape_type/@value='TEXT']/lines/Item/@value", "ele": "//Layer//Shape[shape_type/@value='TEXT']/lines/Item/@value",
"value": "예쁜 노란 꽃", "value": "예쁜 노란 꽃",
"point": 5 "point": 5
}, },
"9": { "9": {
"type": "exact", "type": "exists",
"ele": "//Layer//Shape[shape_type/@value='TEXT']/font/Name/@value", "ele": "//Layer//Shape[shape_type/@value='TEXT']/font/Name/@value",
"value": "맑은 고딕", "value": "맑은 고딕",
"point": 3 "point": 3
}, },
"10": { "10": {
"type": "exact", "type": "exists",
"ele": "//Layer//Shape[shape_type/@value='TEXT']/font/Underline/@value", "ele": "//Layer//Shape[shape_type/@value='TEXT']/font/{style}/@value",
"style": "Underline",
"value": "True", "value": "True",
"point": 3 "point": 3
}, },
"11": { "11": {
"type": "exact", "type": "exists",
"ele": "//Layer//Shape[shape_type/@value='TEXT']/font/Size/@value", "ele": "//Layer//Shape[shape_type/@value='TEXT']/font/Size/@value",
"value": "30", "value": "30",
"point": 3 "point": 3
@@ -611,7 +614,7 @@
"desc": "색상 코드 비교 시 소문자로 입력할 것" "desc": "색상 코드 비교 시 소문자로 입력할 것"
}, },
"13": { "13": {
"type": "exact", "type": "exists",
"ele": "//Layer//Shape[shape_type/@value='TEXT']/outline_peninfo/Width/@value", "ele": "//Layer//Shape[shape_type/@value='TEXT']/outline_peninfo/Width/@value",
"value": "7", "value": "7",
"point": 3 "point": 3
@@ -624,19 +627,20 @@
"desc": "색상 코드 비교 시 소문자로 입력할 것" "desc": "색상 코드 비교 시 소문자로 입력할 것"
}, },
"15": { "15": {
"ele": "//Layer[MaskOpType/@value='Clipping'][last()]", "type":"boolean",
"ele": "//Layer[MaskOpType/@value='Clipping']",
"point": 6, "point": 6,
"desc": "클리핑 마스크 항목은 별도 레이어로 추가되고 해당 속성을 추가해놓은 레이어가 있는지 여부 체크 함" "desc": "클리핑 마스크 항목은 별도 레이어로 추가되고 해당 속성을 추가해놓은 레이어가 있는지 여부 체크 함"
}, },
"16": { "16": {
"ele": "//Layer[contains(Name/@value, 'Layer 3')]//shape_type/@value", "type": "exists",
"ele": "//Layer/Shapes/Shape/shape_type/@value",
"value": "ROUNDED_RECTANGLE", "value": "ROUNDED_RECTANGLE",
"point": 3 "point": 3
}, },
"17": { "17": {
"type": "size", "type": "size",
"posX": "//Layer[contains(Name/@value, 'Layer 5')]//op_points[Item]/Item[last()]/X/@value - //Layer[contains(Name/@value, 'Layer 5')]//op_points[Item]/Item[1]/X/@value", "ele": "//Layer//op_points",
"posY": "//Layer[contains(Name/@value, 'Layer 5')]//op_points[Item]/Item[last()]/Y/@value - //Layer[contains(Name/@value, 'Layer 5')]//op_points[Item]/Item[1]/Y/@value",
"value": { "value": {
"width": 120, "width": 120,
"height": 150 "height": 150
@@ -645,13 +649,14 @@
"desc": "레이어 쉐이프 X, Y 좌표를 가지고 너비, 높이 계산하여 정답 채점" "desc": "레이어 쉐이프 X, Y 좌표를 가지고 너비, 높이 계산하여 정답 채점"
}, },
"18": { "18": {
"ele": "//Layer[contains(Name/@value, 'Layer 5')]//outline_peninfo/Width/@value", "type": "exists",
"ele": "//Layer//outline_peninfo/Width/@value",
"value": "5", "value": "5",
"point": 3 "point": 3
}, },
"19": { "19": {
"type": "color", "type": "color",
"ele": "//Layer//Shape[shape_type/@value='RECTANGLE'][contains(draw_type/@value, 'Outline')]/primary_color/@value", "ele": "//Layer//Shape[contains(draw_type/@value, 'Outline')]/primary_color/@value",
"value": "901651", "value": "901651",
"point": 3, "point": 3,
"desc": "색상 코드 비교 시 소문자로 입력할 것(채우기:secondary_color, 외곽선:primary_color)" "desc": "색상 코드 비교 시 소문자로 입력할 것(채우기:secondary_color, 외곽선:primary_color)"
@@ -659,11 +664,11 @@
"20": { "20": {
"type": "shadow", "type": "shadow",
"ele": { "ele": {
"shadow": "//Layer//Shape[shape_type/@value='RECTANGLE'][contains(draw_type/@value, 'Shadow')]", "shadow": "//Layer//Shape[contains(draw_type/@value, 'Shadow')]",
"width": "//Layer//Shape[shape_type/@value='RECTANGLE'][contains(draw_type/@value, 'Shadow')]/shadow_width/@value", "width": "//Layer//Shape[contains(draw_type/@value, 'Shadow')]/shadow_width/@value",
"distance": "//Layer//Shape[shape_type/@value='RECTANGLE'][contains(draw_type/@value, 'Shadow')]/shadow_distance/@value", "distance": "//Layer//Shape[contains(draw_type/@value, 'Shadow')]/shadow_distance/@value",
"blur": "//Layer//Shape[shape_type/@value='RECTANGLE'][contains(draw_type/@value, 'Shadow')]/shadow_blur/@value", "blur": "//Layer//Shape[contains(draw_type/@value, 'Shadow')]/shadow_blur/@value",
"angle": "//Layer//Shape[shape_type/@value='RECTANGLE'][contains(draw_type/@value, 'Shadow')]/shadow_angle/@value" "angle": "//Layer//Shape[contains(draw_type/@value, 'Shadow')]/shadow_angle/@value"
}, },
"value": { "value": {
"width": "3", "width": "3",

View File

@@ -143,16 +143,16 @@ function getGpdpScore(gpdpData, scoringJson, index) {
if (type == "boolean") { if (type == "boolean") {
const items = xpath.select(ele, gpdpXmlDoc); const items = xpath.select(ele, gpdpXmlDoc);
// xpath 결과값을 반환하는 요소가 을 경우 // xpath 결과값을 반환하는 요소가 을 경우
if (items) { if (!items) {
scoringResult[key] = 0;
console.log("❌ 찾는 요소 없음");
}
else {
totalScore += point; totalScore += point;
scoringResult[key] = point; scoringResult[key] = point;
console.log("✅ 찾는 요소 존재함"); console.log("✅ 찾는 요소 존재함");
} }
else {
scoringResult[key] = 0;
console.log("❌ 찾는 요소 없음");
}
} }
// 이펙트 효과의 이름과 속성값을 비교 // 이펙트 효과의 이름과 속성값을 비교
@@ -163,10 +163,9 @@ function getGpdpScore(gpdpData, scoringJson, index) {
// 각 Item 요소별 이름과 속성값을 구하고 정답과 비교 // 각 Item 요소별 이름과 속성값을 구하고 정답과 비교
for (const item of items) { for (const item of items) {
const name = xpath.select1('Name/@value', item)?.value; const name = xpath.select1('Name/@value', item)?.value;
const value = xpath.select1(`EffectData/${option?.replace(/"/g, '')}/@value`, item)?.value; const attr = xpath.select1(`EffectData/${option?.replace(/"/g, '')}/@value`, item)?.value;
const resultArray = [name, value];
if (JSON.stringify(resultArray) === JSON.stringify(rightAnswer)) { if (name === rightAnswer[0] && attr === rightAnswer[1]) {
totalScore += point; totalScore += point;
scoringResult[key] = point; scoringResult[key] = point;
matched = true; matched = true;
@@ -369,7 +368,7 @@ function getGpdpScore(gpdpData, scoringJson, index) {
// 그림자 속성이 있는지 여부 파악해서 그림자 속성 별로 점수 1 점씩 부여 // 그림자 속성이 있는지 여부 파악해서 그림자 속성 별로 점수 1 점씩 부여
else if (type == "shadow") { else if (type == "shadow") {
let result = xpath.select(ele["shadow"], gpdpXmlDoc); const result = xpath.select(ele["shadow"], gpdpXmlDoc);
let shadowScore = 0; let shadowScore = 0;
if (result.length == 0) { if (result.length == 0) {
scoringResult[key] = 0; scoringResult[key] = 0;
@@ -378,10 +377,10 @@ function getGpdpScore(gpdpData, scoringJson, index) {
} }
shadowScore += 1; shadowScore += 1;
let width = xpath.select(ele["width"], gpdpXmlDoc); const width = xpath.select(ele["width"], gpdpXmlDoc);
let distance = xpath.select(ele["distance"], gpdpXmlDoc); const distance = xpath.select(ele["distance"], gpdpXmlDoc);
let blur = xpath.select(ele["blur"], gpdpXmlDoc); const blur = xpath.select(ele["blur"], gpdpXmlDoc);
let angle = xpath.select(ele["angle"], gpdpXmlDoc); const angle = xpath.select(ele["angle"], gpdpXmlDoc);
if (width.length !== 0 && width[0].value == rightAnswer["width"]) { if (width.length !== 0 && width[0].value == rightAnswer["width"]) {
shadowScore += 1; shadowScore += 1;
@@ -403,9 +402,9 @@ function getGpdpScore(gpdpData, scoringJson, index) {
scoringResult[key] = shadowScore; scoringResult[key] = shadowScore;
} }
else { else {
let result = xpath.select(ele, gpdpXmlDoc); const result = xpath.select(ele, gpdpXmlDoc);
let result2 = null; const result2 = null;
let isCheck = false; const isCheck = false;
if (ele === 'none') { if (ele === 'none') {
scoringResult[key] = "확인필요"; scoringResult[key] = "확인필요";

View File

@@ -14,8 +14,8 @@ const todayDate = getToday();
const examRound = '0000'; const examRound = '0000';
const examTypes = [ const examTypes = [
'A', 'A',
// 'B', 'B',
// 'C', 'C',
// 'D' // 'D'
]; ];
@@ -127,7 +127,12 @@ examTypes.forEach(type => {
XLSX.writeFile(workbook, outputExcelFile); XLSX.writeFile(workbook, outputExcelFile);
outputExcelFiles.push(outputExcelFile); outputExcelFiles.push(outputExcelFile);
}); });
console.log('채점 결과가 ' + outputExcelFiles + ' 파일에 저장되었습니다.');
console.log('채점 결과');
outputExcelFiles.forEach( (outputFile, index) => {
console.log(`[${index+1}] : ${outputFile}`);
});
// xml 형식의 gmep 파일을 읽어서 점수를 계산 // xml 형식의 gmep 파일을 읽어서 점수를 계산
// scoring.json 파일 내에 있는 ele 요소는 xpath 형식으로 접근하여 요소를 탐색하고 나오는 값을 value와 비교하여 점수를 계산 // scoring.json 파일 내에 있는 ele 요소는 xpath 형식으로 접근하여 요소를 탐색하고 나오는 값을 value와 비교하여 점수를 계산